mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-21 20:52:22 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00c214ee5d | ||
|
|
e497b9505a | ||
|
|
b5ac446e55 | ||
|
|
c00e1b39da | ||
|
|
6e6e806476 | ||
|
|
ef877e2f7d | ||
|
|
669aee5ba6 | ||
|
|
ef468097d0 | ||
|
|
22f2eebbd3 | ||
|
|
f658e9ec57 | ||
|
|
ddf93bc425 | ||
|
|
503361d6d1 | ||
|
|
77edab1ba7 | ||
|
|
7760c556a7 | ||
|
|
5a9c7fb027 | ||
|
|
1f3bcbc746 | ||
|
|
d0cdc58b5a | ||
|
|
91bf137a94 | ||
|
|
07f445757b | ||
|
|
f2f1dd1195 | ||
|
|
c70a3448e5 | ||
|
|
65c6f2b591 | ||
|
|
350c7ed1af | ||
|
|
8b07f1ff4f | ||
|
|
09b631faee | ||
|
|
d1d09c3bfb | ||
|
|
1189f1ccb2 | ||
|
|
bf12c01b96 | ||
|
|
f28ae4b8e4 | ||
|
|
d9f5acd98a | ||
|
|
4f3c73ee98 | ||
|
|
a14ed03d5e | ||
|
|
a80a7429b1 | ||
|
|
8541ba8e53 | ||
|
|
3d65061055 | ||
|
|
41d1e97d7c | ||
|
|
a811e2b5e4 | ||
|
|
4ba17bf8f3 | ||
|
|
0ae7dcefa3 | ||
|
|
bc95495504 | ||
|
|
004c540346 | ||
|
|
c43f1f05c5 | ||
|
|
3ce7424abc | ||
|
|
5cafd12ce8 | ||
|
|
9a423c4bfd | ||
|
|
e4d248b5a9 | ||
|
|
4520180638 | ||
|
|
7d14960a72 | ||
|
|
66bb31bfa8 | ||
|
|
37bb054dd3 | ||
|
|
0c9ed04ac5 | ||
|
|
c641da2f7f | ||
|
|
c91da9fee9 | ||
|
|
4d67be487a | ||
|
|
60325eeab9 | ||
|
|
8683a345c3 | ||
|
|
e4329e2b8f | ||
|
|
2e193f2b8f | ||
|
|
bc4ec455e5 | ||
|
|
ba9e3ccf3e | ||
|
|
ea417583b6 | ||
|
|
4ffe81967d | ||
|
|
4aaa092db9 | ||
|
|
2f796f4478 | ||
|
|
68fff7161a | ||
|
|
c7b8f2770a | ||
|
|
280ed91925 | ||
|
|
d08ebbde14 | ||
|
|
51d7f51c44 | ||
|
|
b3bf9ea9ac | ||
|
|
0b23dcdb39 | ||
|
|
7553983e28 | ||
|
|
d47246adbe | ||
|
|
91446f7c07 | ||
|
|
c84b8ae033 | ||
|
|
a64ac3e19c | ||
|
|
a24d7a339c | ||
|
|
d92cae88e2 | ||
|
|
7b021331bb | ||
|
|
3a1b633044 | ||
|
|
7b744a3e2c | ||
|
|
de53168447 | ||
|
|
18073d2f76 | ||
|
|
87581cd03b | ||
|
|
6facfe5fa8 | ||
|
|
e32e427f93 | ||
|
|
fe35f8e237 | ||
|
|
4836d89ed9 | ||
|
|
d486b30dff | ||
|
|
1b9212786f | ||
|
|
d8bf61a44e |
No files matched your search
@@ -0,0 +1,2 @@
|
|||||||
|
# Ignore spotlessApply reformat
|
||||||
|
91bf137a94d1207f943929e0881750a1b8c4f3bf
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
* text eol=lf
|
||||||
|
|
||||||
|
*.[jJ][aA][rR] binary
|
||||||
|
|
||||||
|
*.[pP][nN][gG] binary
|
||||||
|
*.[jJ][pP][gG] binary
|
||||||
|
*.[jJ][pP][eE][gG] binary
|
||||||
|
*.[gG][iI][fF] binary
|
||||||
|
*.[tT][iI][fF] binary
|
||||||
|
*.[tT][iI][fF][fF] binary
|
||||||
|
*.[iI][cC][oO] binary
|
||||||
|
*.[sS][vV][gG] text
|
||||||
|
*.[eE][pP][sS] binary
|
||||||
|
*.[xX][cC][fF] binary
|
||||||
|
|
||||||
|
*.[kK][aA][rR] binary
|
||||||
|
*.[mM]4[aA] binary
|
||||||
|
*.[mM][iI][dD] binary
|
||||||
|
*.[mM][iI][dD][iI] binary
|
||||||
|
*.[mM][pP]3 binary
|
||||||
|
*.[oO][gG][gG] binary
|
||||||
|
*.[rR][aA] binary
|
||||||
|
|
||||||
|
*.7[zZ] binary
|
||||||
|
*.[gG][zZ] binary
|
||||||
|
*.[tT][aA][rR] binary
|
||||||
|
*.[tT][gG][zZ] binary
|
||||||
|
*.[zZ][iI][pP] binary
|
||||||
|
|
||||||
|
*.[tT][cC][nN] binary
|
||||||
|
*.[sS][oO] binary
|
||||||
|
*.[dD][lL][lL] binary
|
||||||
|
*.[dD][yY][lL][iI][bB] binary
|
||||||
|
*.[pP][sS][dD] binary
|
||||||
|
*.[tT][tT][fF] binary
|
||||||
|
*.[oO][tT][fF] binary
|
||||||
|
|
||||||
|
*.[pP][aA][tT][cC][hH] -text
|
||||||
|
|
||||||
|
*.[bB][aA][tT] text eol=crlf
|
||||||
|
*.[cC][mM][dD] text eol=crlf
|
||||||
|
*.[pP][sS]1 text eol=crlf
|
||||||
|
|
||||||
|
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
name: Build and test
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [ master, main ]
|
||||||
|
push:
|
||||||
|
branches: [ master, main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-test:
|
||||||
|
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
|
||||||
|
secrets: inherit
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
name: Release tagged build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: [ '*' ]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-tags:
|
||||||
|
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
|
||||||
|
secrets: inherit
|
||||||
+33
-15
@@ -1,20 +1,38 @@
|
|||||||
.gradle
|
.gradle
|
||||||
# IntelliJ
|
.settings
|
||||||
/build
|
/.idea/
|
||||||
/run
|
/.vscode/
|
||||||
/eclipse
|
/run/
|
||||||
/out
|
/build/
|
||||||
/classes
|
/eclipse/
|
||||||
.idea
|
.classpath
|
||||||
|
.project
|
||||||
|
/bin/
|
||||||
|
/config/
|
||||||
|
/crash-reports/
|
||||||
|
/logs/
|
||||||
|
options.txt
|
||||||
|
/saves/
|
||||||
|
usernamecache.json
|
||||||
|
banned-ips.json
|
||||||
|
banned-players.json
|
||||||
|
eula.txt
|
||||||
|
ops.json
|
||||||
|
server.properties
|
||||||
|
servers.dat
|
||||||
|
usercache.json
|
||||||
|
whitelist.json
|
||||||
|
/out/
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
*.iws
|
*.iws
|
||||||
# minecraft
|
src/main/resources/mixins.*([!.]).json
|
||||||
/config
|
|
||||||
/logs
|
|
||||||
/saves
|
|
||||||
/options.txt
|
|
||||||
/usernamecache.json
|
|
||||||
|
|
||||||
changelog.html
|
|
||||||
*.bat
|
*.bat
|
||||||
|
*.DS_Store
|
||||||
|
!gradlew.bat
|
||||||
|
.factorypath
|
||||||
|
addon.local.gradle
|
||||||
|
addon.local.gradle.kts
|
||||||
|
addon.late.local.gradle
|
||||||
|
addon.late.local.gradle.kts
|
||||||
|
layout.json
|
||||||
-24
@@ -1,24 +0,0 @@
|
|||||||
sudo: required
|
|
||||||
dist: trusty
|
|
||||||
|
|
||||||
language: java
|
|
||||||
jdk: oraclejdk8
|
|
||||||
|
|
||||||
before_cache:
|
|
||||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
|
||||||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
|
||||||
- rm -f $HOME/.gradle/caches/minecraft/deobfedDeps/providedDummy.jar
|
|
||||||
- rm -f $HOME/.gradle/caches/minecraft/deobfedDeps/compileDummy.jar
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $HOME/.gradle/caches/
|
|
||||||
- $HOME/.gradle/wrapper/
|
|
||||||
|
|
||||||
before_install: chmod +x gradlew
|
|
||||||
install:
|
|
||||||
- ./gradlew setupCIWorkspace -S
|
|
||||||
script:
|
|
||||||
- ./gradlew build
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
email: false
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Any Github changes require admin approval
|
||||||
|
/.github/** @GTNewHorizons/admin
|
||||||
|
|
||||||
+1
-676
@@ -1,7 +1,7 @@
|
|||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
@@ -163,678 +163,3 @@ whether future versions of the GNU Lesser General Public License shall
|
|||||||
apply, that proxy's public statement of acceptance of any version is
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
permanent authorization for you to choose that version for the
|
permanent authorization for you to choose that version for the
|
||||||
Library.
|
Library.
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
||||||
+1599
-66
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,12 @@
|
|||||||
|
// Add your dependencies here
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
api('com.github.GTNewHorizons:ForestryMC:4.6.14:dev')
|
||||||
|
implementation('com.github.GTNewHorizons:GTNHLib:0.0.13:dev')
|
||||||
|
|
||||||
|
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.4.5-GTNH:dev')
|
||||||
|
|
||||||
|
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.36:api')
|
||||||
|
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||||
|
compileOnly("curse.maven:extrabiomesxl-60041:2273301")
|
||||||
|
}
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
modName = Binnie Core
|
||||||
|
|
||||||
|
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||||
|
modId = BinnieCore
|
||||||
|
|
||||||
|
modGroup = binnie
|
||||||
|
|
||||||
|
# WHY is there no version field?
|
||||||
|
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
||||||
|
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
||||||
|
|
||||||
|
# Will update your build.gradle automatically whenever an update is available
|
||||||
|
autoUpdateBuildScript = false
|
||||||
|
|
||||||
|
minecraftVersion = 1.7.10
|
||||||
|
forgeVersion = 10.13.4.1614
|
||||||
|
|
||||||
|
# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task.
|
||||||
|
channel = stable
|
||||||
|
mappingsVersion = 12
|
||||||
|
|
||||||
|
# Define other MCP mappings for dependency deobfuscation
|
||||||
|
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||||
|
|
||||||
|
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
|
||||||
|
# restart Minecraft in development. Choose this dependent on your mod:
|
||||||
|
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
||||||
|
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
||||||
|
developmentEnvironmentUserName = Developer
|
||||||
|
|
||||||
|
# Define a source file of your project with:
|
||||||
|
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||||
|
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||||
|
# version in @Mod([...], version = VERSION, [...])
|
||||||
|
# Leave these properties empty to skip individual token replacements
|
||||||
|
replaceGradleTokenInFile = BinnieCore.java
|
||||||
|
gradleTokenModId =
|
||||||
|
gradleTokenModName =
|
||||||
|
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||||
|
gradleTokenGroupName =
|
||||||
|
|
||||||
|
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||||
|
# leave this property empty.
|
||||||
|
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
||||||
|
apiPackage =
|
||||||
|
|
||||||
|
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
||||||
|
# Example value: mymodid_at.cfg
|
||||||
|
accessTransformersFile =
|
||||||
|
|
||||||
|
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||||
|
usesMixins = false
|
||||||
|
# Adds some debug arguments like verbose output and export
|
||||||
|
usesMixinDebug = false
|
||||||
|
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||||
|
mixinPlugin =
|
||||||
|
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||||
|
mixinsPackage =
|
||||||
|
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||||
|
# This parameter is for legacy compatibility only
|
||||||
|
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
||||||
|
coreModClass =
|
||||||
|
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||||
|
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||||
|
containsMixinsAndOrCoreModOnly = false
|
||||||
|
|
||||||
|
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||||
|
forceEnableMixins = false
|
||||||
|
|
||||||
|
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
|
||||||
|
# responsibility check the licence and request permission for distribution, if required.
|
||||||
|
usesShadowedDependencies = false
|
||||||
|
|
||||||
|
|
||||||
|
# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token.
|
||||||
|
|
||||||
|
# The project's ID on Modrinth. Can be either the slug or the ID.
|
||||||
|
# Leave this empty if you don't want to publish on Modrinth.
|
||||||
|
modrinthProjectId =
|
||||||
|
|
||||||
|
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||||
|
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
||||||
|
# Where scope can be one of [required, optional, incompatible, embedded],
|
||||||
|
# type can be one of [project, version],
|
||||||
|
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||||
|
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||||
|
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||||
|
modrinthRelations =
|
||||||
|
|
||||||
|
|
||||||
|
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||||
|
|
||||||
|
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||||
|
# Leave this empty if you don't want to publish on CurseForge.
|
||||||
|
curseForgeProjectId =
|
||||||
|
|
||||||
|
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||||
|
# Syntax: type1:name1;type2:name2;...
|
||||||
|
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||||
|
# and the name is the CurseForge project slug of the other mod.
|
||||||
|
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||||
|
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||||
|
curseForgeRelations =
|
||||||
|
|
||||||
|
|
||||||
|
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
|
||||||
|
# projects. New projects should not use this parameter.
|
||||||
|
customArchiveBaseName = binnie-mods
|
||||||
|
|
||||||
|
# Optional parameter to prevent the source code from being published
|
||||||
|
# noPublishedSources =
|
||||||
|
|
||||||
|
# Uncomment this to disable spotless checks
|
||||||
|
# This should only be uncommented to keep it easier to sync with upstream/other forks.
|
||||||
|
# That is, if there is no other active fork/upstream, NEVER change this.
|
||||||
|
# disableSpotless = true
|
||||||
Vendored
BIN
Binary file not shown.
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip
|
|
||||||
@@ -1,78 +1,126 @@
|
|||||||
#!/usr/bin/env sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## Gradle start up script for UN*X
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
##
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
DEFAULT_JVM_OPTS=""
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD=maximum
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
@@ -81,7 +129,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
|||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD="java"
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
@@ -89,84 +137,109 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
|
||||||
if $cygwin ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=$((i+1))
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
(0) set -- ;;
|
|
||||||
(1) set -- "$args0" ;;
|
|
||||||
(2) set -- "$args0" "$args1" ;;
|
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=$(save "$@")
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
Vendored
+92
-84
@@ -1,84 +1,92 @@
|
|||||||
@if "%DEBUG%" == "" @echo off
|
@rem
|
||||||
@rem ##########################################################################
|
@rem Copyright 2015 the original author or authors.
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@rem
|
@rem you may not use this file except in compliance with the License.
|
||||||
@rem ##########################################################################
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
@rem Set local scope for the variables with windows NT shell
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
set DIRNAME=%~dp0
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
set APP_BASE_NAME=%~n0
|
@rem See the License for the specific language governing permissions and
|
||||||
set APP_HOME=%DIRNAME%
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
@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=
|
@if "%DEBUG%"=="" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
@rem Find java.exe
|
@rem
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
set JAVA_EXE=java.exe
|
@rem ##########################################################################
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
set DIRNAME=%~dp0
|
||||||
echo.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
@rem This is normally unused
|
||||||
echo location of your Java installation.
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
goto fail
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
:findJavaFromJavaHome
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
@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="-Xmx64m" "-Xms64m"
|
||||||
if exist "%JAVA_EXE%" goto init
|
|
||||||
|
@rem Find java.exe
|
||||||
echo.
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
||||||
echo.
|
set JAVA_EXE=java.exe
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
echo location of your Java installation.
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
goto fail
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
:init
|
echo.
|
||||||
@rem Get command-line arguments, handling Windows variants
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
goto fail
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
:findJavaFromJavaHome
|
||||||
set CMD_LINE_ARGS=
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set _SKIP=2
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
:win9xME_args_slurp
|
if exist "%JAVA_EXE%" goto execute
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
echo.
|
||||||
set CMD_LINE_ARGS=%*
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
:execute
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
@rem Setup the command line
|
echo location of your Java installation.
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
goto fail
|
||||||
|
|
||||||
@rem Execute Gradle
|
:execute
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
@rem Setup the command line
|
||||||
|
|
||||||
:end
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
@rem End local scope for the variables with windows NT shell
|
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
|
||||||
|
@rem Execute Gradle
|
||||||
:fail
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
||||||
rem the _cmd.exe /c_ return code!
|
:end
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
@rem End local scope for the variables with windows NT shell
|
||||||
exit /b 1
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:mainEnd
|
:fail
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
:omega
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
before_install:
|
||||||
|
- ./gradlew setupCIWorkspace
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
|||||||
|
// Add any additional repositories for your dependencies here
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
// RetroFuturaGradle
|
||||||
|
name "GTNH Maven"
|
||||||
|
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||||
|
allowInsecureProtocol = true
|
||||||
|
mavenContent {
|
||||||
|
includeGroup("com.gtnewhorizons.retrofuturagradle")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gradlePluginPortal()
|
||||||
|
mavenCentral()
|
||||||
|
mavenLocal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'com.diffplug.blowdryerSetup' version '1.6.0'
|
||||||
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
|
||||||
|
}
|
||||||
|
|
||||||
|
blowdryerSetup {
|
||||||
|
repoSubfolder 'gtnhShared'
|
||||||
|
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
|
||||||
|
//devLocal '.' // Use this when testing config updates locally
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
package binnie;
|
package binnie;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import binnie.core.ManagerBase;
|
import binnie.core.ManagerBase;
|
||||||
import binnie.core.genetics.ManagerGenetics;
|
import binnie.core.genetics.ManagerGenetics;
|
||||||
import binnie.core.item.ManagerItem;
|
import binnie.core.item.ManagerItem;
|
||||||
@@ -8,15 +11,13 @@ import binnie.core.machines.ManagerMachine;
|
|||||||
import binnie.core.mod.config.ManagerConfig;
|
import binnie.core.mod.config.ManagerConfig;
|
||||||
import binnie.core.resource.ManagerResource;
|
import binnie.core.resource.ManagerResource;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public final class Binnie {
|
public final class Binnie {
|
||||||
public static List<ManagerBase> Managers = new ArrayList<>();
|
|
||||||
public static ManagerGenetics Genetics = new ManagerGenetics();
|
public static List<ManagerBase> Managers = new ArrayList<>();
|
||||||
public static ManagerConfig Configuration = new ManagerConfig();
|
public static ManagerGenetics Genetics = new ManagerGenetics();
|
||||||
public static ManagerLiquid Liquid = new ManagerLiquid();
|
public static ManagerConfig Configuration = new ManagerConfig();
|
||||||
public static ManagerMachine Machine = new ManagerMachine();
|
public static ManagerLiquid Liquid = new ManagerLiquid();
|
||||||
public static ManagerItem Item = new ManagerItem();
|
public static ManagerMachine Machine = new ManagerMachine();
|
||||||
public static ManagerResource Resource = new ManagerResource();
|
public static ManagerItem Item = new ManagerItem();
|
||||||
|
public static ManagerResource Resource = new ManagerResource();
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,15 @@
|
|||||||
package binnie.botany;
|
package binnie.botany;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||||
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
|
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.EnumAcidity;
|
||||||
import binnie.botany.api.EnumSoilType;
|
import binnie.botany.api.EnumSoilType;
|
||||||
import binnie.botany.api.IFlower;
|
import binnie.botany.api.IFlower;
|
||||||
@@ -42,298 +52,301 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
|||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
import cpw.mods.fml.common.eventhandler.Event;
|
import cpw.mods.fml.common.eventhandler.Event;
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
|
||||||
import net.minecraftforge.event.world.BlockEvent;
|
|
||||||
|
|
||||||
@Mod(
|
@Mod(
|
||||||
modid = "Botany",
|
modid = "Botany",
|
||||||
name = "Botany",
|
name = "Botany",
|
||||||
useMetadata = true,
|
version = BinnieCore.VERSION,
|
||||||
dependencies = "after:BinnieCore"
|
useMetadata = true,
|
||||||
)
|
dependencies = "after:BinnieCore")
|
||||||
public class Botany extends AbstractMod {
|
public class Botany extends AbstractMod {
|
||||||
@Mod.Instance("Botany")
|
|
||||||
public static Botany instance;
|
|
||||||
|
|
||||||
@SidedProxy(
|
@Mod.Instance("Botany")
|
||||||
clientSide = "binnie.botany.proxy.ProxyClient",
|
public static Botany instance;
|
||||||
serverSide = "binnie.botany.proxy.ProxyServer"
|
|
||||||
)
|
|
||||||
public static Proxy proxy;
|
|
||||||
|
|
||||||
public static BlockFlower flower;
|
@SidedProxy(clientSide = "binnie.botany.proxy.ProxyClient", serverSide = "binnie.botany.proxy.ProxyServer")
|
||||||
public static Item seed;
|
public static Proxy proxy;
|
||||||
public static Item pollen;
|
|
||||||
public static ItemDictionary database;
|
|
||||||
public static BlockPlant plant;
|
|
||||||
public static ItemTrowel trowelWood;
|
|
||||||
public static ItemTrowel trowelStone;
|
|
||||||
public static ItemTrowel trowelIron;
|
|
||||||
public static ItemTrowel trowelDiamond;
|
|
||||||
public static ItemTrowel trowelGold;
|
|
||||||
public static BlockSoil soil;
|
|
||||||
public static BlockSoil loam;
|
|
||||||
public static BlockSoil flowerbed;
|
|
||||||
public static BlockSoil soilNoWeed;
|
|
||||||
public static BlockSoil loamNoWeed;
|
|
||||||
public static BlockSoil flowerbedNoWeed;
|
|
||||||
public static ItemInsulatedTube insulatedTube;
|
|
||||||
public static ItemSoilMeter soilMeter;
|
|
||||||
public static ItemMisc misc;
|
|
||||||
public static ItemFlower flowerItem;
|
|
||||||
public static ItemPigment pigment;
|
|
||||||
public static ItemClay clay;
|
|
||||||
public static BlockCeramic ceramic;
|
|
||||||
public static BlockCeramicPatterned ceramicTile;
|
|
||||||
public static BlockStained stained;
|
|
||||||
public static BlockCeramicBrick ceramicBrick;
|
|
||||||
|
|
||||||
public Botany() {
|
public static BlockFlower flower;
|
||||||
Botany.instance = this;
|
public static Item seed;
|
||||||
}
|
public static Item pollen;
|
||||||
|
public static ItemDictionary database;
|
||||||
|
public static BlockPlant plant;
|
||||||
|
public static ItemTrowel trowelWood;
|
||||||
|
public static ItemTrowel trowelStone;
|
||||||
|
public static ItemTrowel trowelIron;
|
||||||
|
public static ItemTrowel trowelDiamond;
|
||||||
|
public static ItemTrowel trowelGold;
|
||||||
|
public static BlockSoil soil;
|
||||||
|
public static BlockSoil loam;
|
||||||
|
public static BlockSoil flowerbed;
|
||||||
|
public static BlockSoil soilNoWeed;
|
||||||
|
public static BlockSoil loamNoWeed;
|
||||||
|
public static BlockSoil flowerbedNoWeed;
|
||||||
|
public static ItemInsulatedTube insulatedTube;
|
||||||
|
public static ItemSoilMeter soilMeter;
|
||||||
|
public static ItemMisc misc;
|
||||||
|
public static ItemFlower flowerItem;
|
||||||
|
public static ItemPigment pigment;
|
||||||
|
public static ItemClay clay;
|
||||||
|
public static BlockCeramic ceramic;
|
||||||
|
public static BlockCeramicPatterned ceramicTile;
|
||||||
|
public static BlockStained stained;
|
||||||
|
public static BlockCeramicBrick ceramicBrick;
|
||||||
|
|
||||||
@Mod.EventHandler
|
public Botany() {
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
Botany.instance = this;
|
||||||
addModule(new ModuleCore());
|
}
|
||||||
addModule(new ModuleGenetics());
|
|
||||||
addModule(new ModuleGardening());
|
|
||||||
preInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void init(FMLInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
init();
|
addModule(new ModuleCore());
|
||||||
}
|
addModule(new ModuleGenetics());
|
||||||
|
addModule(new ModuleGardening());
|
||||||
|
preInit();
|
||||||
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void postInit(FMLPostInitializationEvent event) {
|
public void init(FMLInitializationEvent event) {
|
||||||
postInit();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Mod.EventHandler
|
||||||
public IBinnieGUID[] getGUIDs() {
|
public void postInit(FMLPostInitializationEvent event) {
|
||||||
return BotanyGUI.values();
|
postInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?>[] getConfigs() {
|
public IBinnieGUID[] getGUIDs() {
|
||||||
return new Class[0];
|
return BotanyGUI.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPacketID[] getPacketIDs() {
|
public Class<?>[] getConfigs() {
|
||||||
return PacketID.values();
|
return new Class[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IProxyCore getProxy() {
|
public IPacketID[] getPacketIDs() {
|
||||||
return Botany.proxy;
|
return PacketID.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getChannel() {
|
public IProxyCore getProxy() {
|
||||||
return "BOT";
|
return Botany.proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModID() {
|
public String getChannel() {
|
||||||
return "botany";
|
return "BOT";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
public String getModID() {
|
||||||
return PacketHandler.class;
|
return "botany";
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@Override
|
||||||
public void onShearFlower(PlayerInteractEvent event) {
|
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
return PacketHandler.class;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem() == Items.shears) {
|
@SubscribeEvent
|
||||||
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
public void onShearFlower(PlayerInteractEvent event) {
|
||||||
if (tile instanceof TileEntityFlower) {
|
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
return;
|
||||||
flower.onShear();
|
}
|
||||||
event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem() == Botany.pollen) {
|
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null
|
||||||
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
&& event.entityPlayer.getHeldItem().getItem() == Items.shears) {
|
||||||
if (tile instanceof TileEntityFlower) {
|
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
if (tile instanceof TileEntityFlower) {
|
||||||
IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.entityPlayer.getHeldItem());
|
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||||
if (pollen != null && flower.canMateWith(pollen)) {
|
flower.onShear();
|
||||||
flower.mateWith(pollen);
|
event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
|
||||||
if (!event.entityPlayer.capabilities.isCreativeMode) {
|
}
|
||||||
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
}
|
||||||
heldItem.stackSize--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null
|
||||||
public void onFertiliseSoil(PlayerInteractEvent event) {
|
&& event.entityPlayer.getHeldItem().getItem() == Botany.pollen) {
|
||||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK || event.world == null) {
|
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||||
return;
|
if (tile instanceof TileEntityFlower) {
|
||||||
}
|
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||||
|
IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.entityPlayer.getHeldItem());
|
||||||
|
if (pollen != null && flower.canMateWith(pollen)) {
|
||||||
|
flower.mateWith(pollen);
|
||||||
|
if (!event.entityPlayer.capabilities.isCreativeMode) {
|
||||||
|
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||||
|
heldItem.stackSize--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (event.entityPlayer == null || event.entityPlayer.getHeldItem() == null) {
|
@SubscribeEvent
|
||||||
return;
|
public void onFertiliseSoil(PlayerInteractEvent event) {
|
||||||
}
|
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK || event.world == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int y = event.y;
|
if (event.entityPlayer == null || event.entityPlayer.getHeldItem() == null) {
|
||||||
Block block = event.world.getBlock(event.x, y, event.z);
|
return;
|
||||||
if (block == null || !Gardening.isSoil(block)) {
|
}
|
||||||
block = event.world.getBlock(event.x, --y, event.z);
|
|
||||||
}
|
|
||||||
if (block == null || !Gardening.isSoil(block)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IBlockSoil soil = (IBlockSoil) block;
|
int y = event.y;
|
||||||
if (Gardening.isNutrientFertiliser(event.entityPlayer.getHeldItem()) && soil.getType(event.world, event.x, y, event.z) != EnumSoilType.FLOWERBED) {
|
Block block = event.world.getBlock(event.x, y, event.z);
|
||||||
EnumSoilType type = soil.getType(event.world, event.x, y, event.z);
|
if (block == null || !Gardening.isSoil(block)) {
|
||||||
int next = Math.min(type.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
block = event.world.getBlock(event.x, --y, event.z);
|
||||||
if (soil.fertilise(event.world, event.x, y, event.z, EnumSoilType.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
|
}
|
||||||
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
if (block == null || !Gardening.isSoil(block)) {
|
||||||
heldItem.stackSize--;
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Gardening.isAcidFertiliser(event.entityPlayer.getHeldItem()) && soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.ACID) {
|
IBlockSoil soil = (IBlockSoil) block;
|
||||||
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
if (Gardening.isNutrientFertiliser(event.entityPlayer.getHeldItem())
|
||||||
int next = Math.max(pH.ordinal() - Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 0);
|
&& soil.getType(event.world, event.x, y, event.z) != EnumSoilType.FLOWERBED) {
|
||||||
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
|
EnumSoilType type = soil.getType(event.world, event.x, y, event.z);
|
||||||
ItemStack heldItem2 = event.entityPlayer.getHeldItem();
|
int next = Math.min(type.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
||||||
heldItem2.stackSize--;
|
if (soil.fertilise(event.world, event.x, y, event.z, EnumSoilType.values()[next])
|
||||||
return;
|
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||||
}
|
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||||
}
|
heldItem.stackSize--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Gardening.isAlkalineFertiliser(event.entityPlayer.getHeldItem()) && soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.ALKALINE) {
|
if (Gardening.isAcidFertiliser(event.entityPlayer.getHeldItem())
|
||||||
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
&& soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.ACID) {
|
||||||
int next = Math.min(pH.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
||||||
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
|
int next = Math.max(pH.ordinal() - Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 0);
|
||||||
ItemStack heldItem3 = event.entityPlayer.getHeldItem();
|
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next])
|
||||||
heldItem3.stackSize--;
|
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||||
return;
|
ItemStack heldItem2 = event.entityPlayer.getHeldItem();
|
||||||
}
|
heldItem2.stackSize--;
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Gardening.isWeedkiller(event.entityPlayer.getHeldItem()) && Gardening.addWeedKiller(event.world, event.x, y, event.z) && !event.entityPlayer.capabilities.isCreativeMode) {
|
if (Gardening.isAlkalineFertiliser(event.entityPlayer.getHeldItem())
|
||||||
ItemStack heldItem4 = event.entityPlayer.getHeldItem();
|
&& soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.ALKALINE) {
|
||||||
heldItem4.stackSize--;
|
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
||||||
}
|
int next = Math.min(pH.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
||||||
}
|
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next])
|
||||||
|
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||||
|
ItemStack heldItem3 = event.entityPlayer.getHeldItem();
|
||||||
|
heldItem3.stackSize--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
if (Gardening.isWeedkiller(event.entityPlayer.getHeldItem())
|
||||||
public void plantVanilla(BlockEvent.PlaceEvent event) {
|
&& Gardening.addWeedKiller(event.world, event.x, y, event.z)
|
||||||
World world = event.world;
|
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||||
int x = event.x;
|
ItemStack heldItem4 = event.entityPlayer.getHeldItem();
|
||||||
int y = event.y;
|
heldItem4.stackSize--;
|
||||||
int z = event.z;
|
}
|
||||||
Block block = world.getBlock(x, y - 1, z);
|
}
|
||||||
if (!(block instanceof IBlockSoil)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.itemInHand);
|
@SubscribeEvent
|
||||||
if (flower != null) {
|
public void plantVanilla(BlockEvent.PlaceEvent event) {
|
||||||
Gardening.plant(world, x, y, z, flower, event.player.getGameProfile());
|
World world = event.world;
|
||||||
}
|
int x = event.x;
|
||||||
}
|
int y = event.y;
|
||||||
|
int z = event.z;
|
||||||
|
Block block = world.getBlock(x, y - 1, z);
|
||||||
|
if (!(block instanceof IBlockSoil)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated
|
IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.itemInHand);
|
||||||
public void onPlantVanilla(PlayerInteractEvent event) {
|
if (flower != null) {
|
||||||
if (!BinnieCore.proxy.isSimulating(event.world) || event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
Gardening.plant(world, x, y, z, flower, event.player.getGameProfile());
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
if (event.entityPlayer == null || event.entityPlayer.getHeldItem() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
World world = event.world;
|
@Deprecated
|
||||||
int x = event.x;
|
public void onPlantVanilla(PlayerInteractEvent event) {
|
||||||
int y = event.y;
|
if (!BinnieCore.proxy.isSimulating(event.world)
|
||||||
int z = event.z;
|
|| event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||||
Block block = world.getBlock(x, y, z);
|
return;
|
||||||
int py = -1;
|
}
|
||||||
if (block instanceof IBlockSoil && (world.isAirBlock(x, y + 1, z) || world.getBlock(x, y, z).isReplaceable(world, x, y, z))) {
|
if (event.entityPlayer == null || event.entityPlayer.getHeldItem() == null) {
|
||||||
py = 1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (py < 0) {
|
World world = event.world;
|
||||||
return;
|
int x = event.x;
|
||||||
}
|
int y = event.y;
|
||||||
|
int z = event.z;
|
||||||
|
Block block = world.getBlock(x, y, z);
|
||||||
|
int py = -1;
|
||||||
|
if (block instanceof IBlockSoil
|
||||||
|
&& (world.isAirBlock(x, y + 1, z) || world.getBlock(x, y, z).isReplaceable(world, x, y, z))) {
|
||||||
|
py = 1;
|
||||||
|
}
|
||||||
|
|
||||||
IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.entityPlayer.getHeldItem());
|
if (py < 0) {
|
||||||
if (flower != null && Gardening.plant(world, x, y + py, z, flower, event.entityPlayer.getGameProfile()) && !event.entityPlayer.capabilities.isCreativeMode) {
|
return;
|
||||||
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
}
|
||||||
heldItem.stackSize--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.entityPlayer.getHeldItem());
|
||||||
public void onBonemeal(BonemealEvent event) {
|
if (flower != null && Gardening.plant(world, x, y + py, z, flower, event.entityPlayer.getGameProfile())
|
||||||
Block block = event.world.getBlock(event.x, event.y, event.z);
|
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||||
if (Gardening.isSoil(block)) {
|
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||||
IBlockSoil soil = (IBlockSoil) block;
|
heldItem.stackSize--;
|
||||||
if (soil.fertilise(event.world, event.x, event.y, event.z, EnumSoilType.LOAM)) {
|
}
|
||||||
event.setResult(Event.Result.ALLOW);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
@SubscribeEvent
|
||||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
|
public void onBonemeal(BonemealEvent event) {
|
||||||
event.setResult(Event.Result.ALLOW);
|
Block block = event.world.getBlock(event.x, event.y, event.z);
|
||||||
}
|
if (Gardening.isSoil(block)) {
|
||||||
}
|
IBlockSoil soil = (IBlockSoil) block;
|
||||||
|
if (soil.fertilise(event.world, event.x, event.y, event.z, EnumSoilType.LOAM)) {
|
||||||
|
event.setResult(Event.Result.ALLOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||||
public boolean isActive() {
|
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
|
||||||
return BinnieCore.isBotanyActive();
|
event.setResult(Event.Result.ALLOW);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Override
|
||||||
public void onIMC(FMLInterModComms.IMCEvent event) {
|
public boolean isActive() {
|
||||||
for (FMLInterModComms.IMCMessage message : event.getMessages()) {
|
return BinnieCore.isBotanyActive();
|
||||||
if (message.key.equals("add-nutrient-fertiliser-1")) {
|
}
|
||||||
ModuleGardening.queuedNutrientFertilisers.put(message.getItemStackValue(), 1);
|
|
||||||
}
|
|
||||||
if (message.key.equals("add-nutrient-fertiliser-2")) {
|
|
||||||
ModuleGardening.queuedNutrientFertilisers.put(message.getItemStackValue(), 2);
|
|
||||||
}
|
|
||||||
if (message.key.equals("add-acid-fertiliser-1")) {
|
|
||||||
ModuleGardening.queuedAcidFertilisers.put(message.getItemStackValue(), 1);
|
|
||||||
}
|
|
||||||
if (message.key.equals("add-acid-fertiliser-2")) {
|
|
||||||
ModuleGardening.queuedAcidFertilisers.put(message.getItemStackValue(), 2);
|
|
||||||
}
|
|
||||||
if (message.key.equals("add-alkaline-fertiliser-1")) {
|
|
||||||
ModuleGardening.queuedAlkalineFertilisers.put(message.getItemStackValue(), 1);
|
|
||||||
}
|
|
||||||
if (message.key.equals("add-alkaline-fertiliser-2")) {
|
|
||||||
ModuleGardening.queuedAlkalineFertilisers.put(message.getItemStackValue(), 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class PacketHandler extends BinniePacketHandler {
|
@Mod.EventHandler
|
||||||
public PacketHandler() {
|
public void onIMC(FMLInterModComms.IMCEvent event) {
|
||||||
super(Botany.instance);
|
for (FMLInterModComms.IMCMessage message : event.getMessages()) {
|
||||||
}
|
if (message.key.equals("add-nutrient-fertiliser-1")) {
|
||||||
}
|
ModuleGardening.queuedNutrientFertilisers.put(message.getItemStackValue(), 1);
|
||||||
|
}
|
||||||
|
if (message.key.equals("add-nutrient-fertiliser-2")) {
|
||||||
|
ModuleGardening.queuedNutrientFertilisers.put(message.getItemStackValue(), 2);
|
||||||
|
}
|
||||||
|
if (message.key.equals("add-acid-fertiliser-1")) {
|
||||||
|
ModuleGardening.queuedAcidFertilisers.put(message.getItemStackValue(), 1);
|
||||||
|
}
|
||||||
|
if (message.key.equals("add-acid-fertiliser-2")) {
|
||||||
|
ModuleGardening.queuedAcidFertilisers.put(message.getItemStackValue(), 2);
|
||||||
|
}
|
||||||
|
if (message.key.equals("add-alkaline-fertiliser-1")) {
|
||||||
|
ModuleGardening.queuedAlkalineFertilisers.put(message.getItemStackValue(), 1);
|
||||||
|
}
|
||||||
|
if (message.key.equals("add-alkaline-fertiliser-2")) {
|
||||||
|
ModuleGardening.queuedAlkalineFertilisers.put(message.getItemStackValue(), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class PacketHandler extends BinniePacketHandler {
|
||||||
|
|
||||||
|
public PacketHandler() {
|
||||||
|
super(Botany.instance);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,39 +1,41 @@
|
|||||||
package binnie.botany;
|
package binnie.botany;
|
||||||
|
|
||||||
import binnie.core.util.I18N;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class CreativeTabBotany extends CreativeTabs {
|
public class CreativeTabBotany extends CreativeTabs {
|
||||||
public static CreativeTabs instance = new CreativeTabBotany();
|
|
||||||
|
|
||||||
public CreativeTabBotany() {
|
public static CreativeTabs instance = new CreativeTabBotany();
|
||||||
super("Botany");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public CreativeTabBotany() {
|
||||||
public ItemStack getIconItemStack() {
|
super("Botany");
|
||||||
return new ItemStack(Blocks.red_flower, 1, 5);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTranslatedTabLabel() {
|
public ItemStack getIconItemStack() {
|
||||||
return getTabLabel();
|
return new ItemStack(Blocks.red_flower, 1, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public String getTranslatedTabLabel() {
|
||||||
public String getTabLabel() {
|
return getTabLabel();
|
||||||
return I18N.localise("botany.tab.botany");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public Item getTabIconItem() {
|
public String getTabLabel() {
|
||||||
return Item.getItemFromBlock(Blocks.yellow_flower);
|
return I18N.localise("botany.tab.botany");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public Item getTabIconItem() {
|
||||||
|
return Item.getItemFromBlock(Blocks.yellow_flower);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
public enum EnumAcidity {
|
public enum EnumAcidity {
|
||||||
ACID,
|
|
||||||
NEUTRAL,
|
|
||||||
ALKALINE;
|
|
||||||
|
|
||||||
public String getID() {
|
ACID,
|
||||||
return name().toLowerCase();
|
NEUTRAL,
|
||||||
}
|
ALKALINE;
|
||||||
|
|
||||||
|
public String getID() {
|
||||||
|
return name().toLowerCase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -10,37 +10,38 @@ import forestry.api.genetics.IChromosomeType;
|
|||||||
import forestry.api.genetics.ISpeciesRoot;
|
import forestry.api.genetics.ISpeciesRoot;
|
||||||
|
|
||||||
public enum EnumFlowerChromosome implements IChromosomeType {
|
public enum EnumFlowerChromosome implements IChromosomeType {
|
||||||
SPECIES(IAlleleFlowerSpecies.class),
|
|
||||||
PRIMARY(IAlleleInteger.class),
|
|
||||||
SECONDARY(IAlleleInteger.class),
|
|
||||||
FERTILITY(IAlleleInteger.class),
|
|
||||||
TERRITORY(IAlleleArea.class),
|
|
||||||
EFFECT(IAlleleFlowerEffect.class),
|
|
||||||
LIFESPAN(IAlleleInteger.class),
|
|
||||||
TEMPERATURE_TOLERANCE(IAlleleTolerance.class),
|
|
||||||
HUMIDITY_TOLERANCE(IAlleleTolerance.class),
|
|
||||||
PH_TOLERANCE(IAlleleTolerance.class),
|
|
||||||
SAPPINESS(IAlleleFloat.class),
|
|
||||||
STEM(IAlleleInteger.class);
|
|
||||||
|
|
||||||
private Class<? extends IAllele> cls;
|
SPECIES(IAlleleFlowerSpecies.class),
|
||||||
|
PRIMARY(IAlleleInteger.class),
|
||||||
|
SECONDARY(IAlleleInteger.class),
|
||||||
|
FERTILITY(IAlleleInteger.class),
|
||||||
|
TERRITORY(IAlleleArea.class),
|
||||||
|
EFFECT(IAlleleFlowerEffect.class),
|
||||||
|
LIFESPAN(IAlleleInteger.class),
|
||||||
|
TEMPERATURE_TOLERANCE(IAlleleTolerance.class),
|
||||||
|
HUMIDITY_TOLERANCE(IAlleleTolerance.class),
|
||||||
|
PH_TOLERANCE(IAlleleTolerance.class),
|
||||||
|
SAPPINESS(IAlleleFloat.class),
|
||||||
|
STEM(IAlleleInteger.class);
|
||||||
|
|
||||||
EnumFlowerChromosome(Class<? extends IAllele> cls) {
|
private Class<? extends IAllele> cls;
|
||||||
this.cls = cls;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
EnumFlowerChromosome(Class<? extends IAllele> cls) {
|
||||||
public Class<? extends IAllele> getAlleleClass() {
|
this.cls = cls;
|
||||||
return cls;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public Class<? extends IAllele> getAlleleClass() {
|
||||||
return toString().toLowerCase();
|
return cls;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ISpeciesRoot getSpeciesRoot() {
|
public String getName() {
|
||||||
return AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers");
|
return toString().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ISpeciesRoot getSpeciesRoot() {
|
||||||
|
return AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,19 @@
|
|||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
public enum EnumFlowerStage {
|
public enum EnumFlowerStage {
|
||||||
FLOWER("Flower"),
|
|
||||||
SEED("Seed"),
|
|
||||||
POLLEN("Pollen"),
|
|
||||||
NONE("NONE");
|
|
||||||
|
|
||||||
protected String name;
|
FLOWER("Flower"),
|
||||||
|
SEED("Seed"),
|
||||||
|
POLLEN("Pollen"),
|
||||||
|
NONE("NONE");
|
||||||
|
|
||||||
EnumFlowerStage(String name) {
|
protected String name;
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
EnumFlowerStage(String name) {
|
||||||
return name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
public enum EnumMoisture {
|
public enum EnumMoisture {
|
||||||
DRY,
|
|
||||||
NORMAL,
|
|
||||||
DAMP;
|
|
||||||
|
|
||||||
public String getID() {
|
DRY,
|
||||||
return name().toLowerCase();
|
NORMAL,
|
||||||
}
|
DAMP;
|
||||||
|
|
||||||
|
public String getID() {
|
||||||
|
return name().toLowerCase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
public enum EnumSoilType {
|
public enum EnumSoilType {
|
||||||
SOIL,
|
|
||||||
LOAM,
|
|
||||||
FLOWERBED;
|
|
||||||
|
|
||||||
public String getID() {
|
SOIL,
|
||||||
return name().toLowerCase();
|
LOAM,
|
||||||
}
|
FLOWERBED;
|
||||||
|
|
||||||
|
public String getID() {
|
||||||
|
return name().toLowerCase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import forestry.api.genetics.IAlleleEffect;
|
import forestry.api.genetics.IAlleleEffect;
|
||||||
import forestry.api.genetics.IEffectData;
|
import forestry.api.genetics.IEffectData;
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public interface IAlleleFlowerEffect extends IAlleleEffect {
|
public interface IAlleleFlowerEffect extends IAlleleEffect {
|
||||||
IEffectData doEffect(IFlowerGenome genome, IEffectData storedData, World world, int x, int y, int z);
|
|
||||||
|
IEffectData doEffect(IFlowerGenome genome, IEffectData storedData, World world, int x, int y, int z);
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,10 @@ package binnie.botany.api;
|
|||||||
import forestry.api.genetics.IAlleleSpecies;
|
import forestry.api.genetics.IAlleleSpecies;
|
||||||
|
|
||||||
public interface IAlleleFlowerSpecies extends IAlleleSpecies {
|
public interface IAlleleFlowerSpecies extends IAlleleSpecies {
|
||||||
IFlowerType getType();
|
|
||||||
|
|
||||||
EnumAcidity getPH();
|
IFlowerType getType();
|
||||||
|
|
||||||
EnumMoisture getMoisture();
|
EnumAcidity getPH();
|
||||||
|
|
||||||
|
EnumMoisture getMoisture();
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
public interface IColourMix {
|
public interface IColourMix {
|
||||||
IFlowerColor getColor1();
|
|
||||||
|
|
||||||
IFlowerColor getColor2();
|
IFlowerColor getColor1();
|
||||||
|
|
||||||
boolean isMutation(IFlowerColor color1, IFlowerColor color2);
|
IFlowerColor getColor2();
|
||||||
|
|
||||||
int getChance();
|
boolean isMutation(IFlowerColor color1, IFlowerColor color2);
|
||||||
|
|
||||||
IFlowerColor getResult();
|
int getChance();
|
||||||
|
|
||||||
|
IFlowerColor getResult();
|
||||||
}
|
}
|
||||||
@@ -1,33 +1,35 @@
|
|||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
import forestry.api.genetics.IIndividual;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import forestry.api.genetics.IIndividual;
|
||||||
|
|
||||||
public interface IFlower extends IIndividual {
|
public interface IFlower extends IIndividual {
|
||||||
@Override
|
|
||||||
IFlowerGenome getGenome();
|
|
||||||
|
|
||||||
IFlowerGenome getMate();
|
@Override
|
||||||
|
IFlowerGenome getGenome();
|
||||||
|
|
||||||
void mate(IFlower other);
|
IFlowerGenome getMate();
|
||||||
|
|
||||||
int getAge();
|
void mate(IFlower other);
|
||||||
|
|
||||||
void setAge(int age);
|
int getAge();
|
||||||
|
|
||||||
void age();
|
void setAge(int age);
|
||||||
|
|
||||||
IFlower getOffspring(World world);
|
void age();
|
||||||
|
|
||||||
int getMaxAge();
|
IFlower getOffspring(World world);
|
||||||
|
|
||||||
boolean isWilted();
|
int getMaxAge();
|
||||||
|
|
||||||
void setWilted(boolean value);
|
boolean isWilted();
|
||||||
|
|
||||||
boolean hasFlowered();
|
void setWilted(boolean value);
|
||||||
|
|
||||||
void setFlowered(boolean value);
|
boolean hasFlowered();
|
||||||
|
|
||||||
void removeMate();
|
void setFlowered(boolean value);
|
||||||
|
|
||||||
|
void removeMate();
|
||||||
}
|
}
|
||||||
@@ -3,11 +3,12 @@ package binnie.botany.api;
|
|||||||
import forestry.api.genetics.IAlleleInteger;
|
import forestry.api.genetics.IAlleleInteger;
|
||||||
|
|
||||||
public interface IFlowerColor {
|
public interface IFlowerColor {
|
||||||
int getColor(boolean dis);
|
|
||||||
|
|
||||||
IAlleleInteger getAllele();
|
int getColor(boolean dis);
|
||||||
|
|
||||||
int getID();
|
IAlleleInteger getAllele();
|
||||||
|
|
||||||
String getName();
|
int getID();
|
||||||
|
|
||||||
|
String getName();
|
||||||
}
|
}
|
||||||
@@ -5,37 +5,38 @@ import forestry.api.genetics.EnumTolerance;
|
|||||||
import forestry.api.genetics.IGenome;
|
import forestry.api.genetics.IGenome;
|
||||||
|
|
||||||
public interface IFlowerGenome extends IGenome {
|
public interface IFlowerGenome extends IGenome {
|
||||||
@Override
|
|
||||||
IAlleleFlowerSpecies getPrimary();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IAlleleFlowerSpecies getSecondary();
|
IAlleleFlowerSpecies getPrimary();
|
||||||
|
|
||||||
IFlowerColor getPrimaryColor();
|
@Override
|
||||||
|
IAlleleFlowerSpecies getSecondary();
|
||||||
|
|
||||||
IFlowerColor getSecondaryColor();
|
IFlowerColor getPrimaryColor();
|
||||||
|
|
||||||
IFlowerColor getStemColor();
|
IFlowerColor getSecondaryColor();
|
||||||
|
|
||||||
int getFertility();
|
IFlowerColor getStemColor();
|
||||||
|
|
||||||
int getLifespan();
|
int getFertility();
|
||||||
|
|
||||||
IFlowerType getType();
|
int getLifespan();
|
||||||
|
|
||||||
EnumTolerance getToleranceTemperature();
|
IFlowerType getType();
|
||||||
|
|
||||||
EnumTolerance getToleranceMoisture();
|
EnumTolerance getToleranceTemperature();
|
||||||
|
|
||||||
EnumTolerance getTolerancePH();
|
EnumTolerance getToleranceMoisture();
|
||||||
|
|
||||||
float getAgeChance();
|
EnumTolerance getTolerancePH();
|
||||||
|
|
||||||
float getSappiness();
|
float getAgeChance();
|
||||||
|
|
||||||
boolean canTolerate(EnumAcidity pH);
|
float getSappiness();
|
||||||
|
|
||||||
boolean canTolerate(EnumMoisture moisture);
|
boolean canTolerate(EnumAcidity pH);
|
||||||
|
|
||||||
boolean canTolerate(EnumTemperature temp);
|
boolean canTolerate(EnumMoisture moisture);
|
||||||
|
|
||||||
|
boolean canTolerate(EnumTemperature temp);
|
||||||
}
|
}
|
||||||
@@ -5,5 +5,6 @@ import forestry.api.genetics.IGenome;
|
|||||||
import forestry.api.genetics.IMutation;
|
import forestry.api.genetics.IMutation;
|
||||||
|
|
||||||
public interface IFlowerMutation extends IMutation {
|
public interface IFlowerMutation extends IMutation {
|
||||||
float getChance(IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
|
|
||||||
|
float getChance(IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
|
||||||
}
|
}
|
||||||
@@ -1,44 +1,47 @@
|
|||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
import forestry.api.genetics.IAllele;
|
|
||||||
import forestry.api.genetics.ISpeciesRoot;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
|
import forestry.api.genetics.IAllele;
|
||||||
|
import forestry.api.genetics.ISpeciesRoot;
|
||||||
|
|
||||||
public interface IFlowerRoot extends ISpeciesRoot {
|
public interface IFlowerRoot extends ISpeciesRoot {
|
||||||
@Override
|
|
||||||
IFlower getMember(ItemStack stack);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IFlower templateAsIndividual(IAllele[] template);
|
IFlower getMember(ItemStack stack);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IFlower templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive);
|
IFlower templateAsIndividual(IAllele[] template);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IFlowerGenome templateAsGenome(IAllele[] template);
|
IFlower templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IFlowerGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
|
IFlowerGenome templateAsGenome(IAllele[] template);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IBotanistTracker getBreedingTracker(World world, GameProfile player);
|
IFlowerGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Collection<IFlowerMutation> getMutations(boolean shuffle);
|
IBotanistTracker getBreedingTracker(World world, GameProfile player);
|
||||||
|
|
||||||
EnumFlowerStage getStageType(ItemStack stack);
|
@Override
|
||||||
|
Collection<IFlowerMutation> getMutations(boolean shuffle);
|
||||||
|
|
||||||
IFlower getFlower(World world, IFlowerGenome genome);
|
EnumFlowerStage getStageType(ItemStack stack);
|
||||||
|
|
||||||
void addConversion(ItemStack stack, IAllele[] template);
|
IFlower getFlower(World world, IFlowerGenome genome);
|
||||||
|
|
||||||
IFlower getConversion(ItemStack stack);
|
void addConversion(ItemStack stack, IAllele[] template);
|
||||||
|
|
||||||
Collection<IColourMix> getColourMixes(boolean shuffle);
|
IFlower getConversion(ItemStack stack);
|
||||||
|
|
||||||
void registerColourMix(IColourMix colorMix);
|
Collection<IColourMix> getColourMixes(boolean shuffle);
|
||||||
|
|
||||||
|
void registerColourMix(IColourMix colorMix);
|
||||||
}
|
}
|
||||||
@@ -3,15 +3,16 @@ package binnie.botany.api;
|
|||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
public interface IFlowerType {
|
public interface IFlowerType {
|
||||||
IIcon getStem(EnumFlowerStage stage, boolean flowered, int section);
|
|
||||||
|
|
||||||
IIcon getPetalIcon(EnumFlowerStage stage, boolean flowered, int section);
|
IIcon getStem(EnumFlowerStage stage, boolean flowered, int section);
|
||||||
|
|
||||||
IIcon getVariantIcon(EnumFlowerStage stage, boolean flowered, int section);
|
IIcon getPetalIcon(EnumFlowerStage stage, boolean flowered, int section);
|
||||||
|
|
||||||
int getID();
|
IIcon getVariantIcon(EnumFlowerStage stage, boolean flowered, int section);
|
||||||
|
|
||||||
int getSections();
|
int getID();
|
||||||
|
|
||||||
int ordinal();
|
int getSections();
|
||||||
|
|
||||||
|
int ordinal();
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,26 @@
|
|||||||
package binnie.botany.api.gardening;
|
package binnie.botany.api.gardening;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.EnumAcidity;
|
||||||
import binnie.botany.api.EnumMoisture;
|
import binnie.botany.api.EnumMoisture;
|
||||||
import binnie.botany.api.EnumSoilType;
|
import binnie.botany.api.EnumSoilType;
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public interface IBlockSoil {
|
public interface IBlockSoil {
|
||||||
EnumAcidity getPH(World world, int x, int y, int z);
|
|
||||||
|
|
||||||
EnumMoisture getMoisture(World world, int x, int y, int z);
|
EnumAcidity getPH(World world, int x, int y, int z);
|
||||||
|
|
||||||
EnumSoilType getType(World world, int x, int y, int z);
|
EnumMoisture getMoisture(World world, int x, int y, int z);
|
||||||
|
|
||||||
boolean fertilise(World world, int x, int y, int z, EnumSoilType maxLevel);
|
EnumSoilType getType(World world, int x, int y, int z);
|
||||||
|
|
||||||
boolean degrade(World world, int x, int y, int z, EnumSoilType minLevel);
|
boolean fertilise(World world, int x, int y, int z, EnumSoilType maxLevel);
|
||||||
|
|
||||||
boolean setPH(World world, int x, int y, int z, EnumAcidity pH);
|
boolean degrade(World world, int x, int y, int z, EnumSoilType minLevel);
|
||||||
|
|
||||||
boolean setMoisture(World world, int x, int y, int z, EnumMoisture p4);
|
boolean setPH(World world, int x, int y, int z, EnumAcidity pH);
|
||||||
|
|
||||||
boolean resistsWeeds(World world, int x, int y, int z);
|
boolean setMoisture(World world, int x, int y, int z, EnumMoisture p4);
|
||||||
|
|
||||||
|
boolean resistsWeeds(World world, int x, int y, int z);
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,8 @@
|
|||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import java.util.ArrayList;
|
||||||
import binnie.botany.CreativeTabBotany;
|
import java.util.List;
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
|
||||||
import binnie.core.block.BlockMetadata;
|
|
||||||
import binnie.core.block.IBlockMetadata;
|
|
||||||
import binnie.core.block.TileEntityMetadata;
|
|
||||||
import binnie.core.util.I18N;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -24,123 +18,131 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import binnie.botany.Botany;
|
||||||
import java.util.List;
|
import binnie.botany.CreativeTabBotany;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.core.block.BlockMetadata;
|
||||||
|
import binnie.core.block.IBlockMetadata;
|
||||||
|
import binnie.core.block.TileEntityMetadata;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockCeramic extends Block implements IBlockMetadata {
|
public class BlockCeramic extends Block implements IBlockMetadata {
|
||||||
public BlockCeramic() {
|
|
||||||
super(Material.rock);
|
|
||||||
setHardness(1.0f);
|
|
||||||
setResistance(5.0f);
|
|
||||||
setBlockName("ceramic");
|
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public BlockCeramic() {
|
||||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
super(Material.rock);
|
||||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
setHardness(1.0f);
|
||||||
}
|
setResistance(5.0f);
|
||||||
|
setBlockName("ceramic");
|
||||||
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World var1, int i) {
|
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||||
return new TileEntityMetadata();
|
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasTileEntity(int meta) {
|
public TileEntity createNewTileEntity(World var1, int i) {
|
||||||
return true;
|
return new TileEntityMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
public boolean hasTileEntity(int meta) {
|
||||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
return true;
|
||||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
}
|
||||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||||
return TileEntityMetadata.getItemDamage(itemStack);
|
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||||
}
|
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||||
|
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||||
return tileMeta;
|
return TileEntityMetadata.getItemDamage(itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBlockName(ItemStack itemStack) {
|
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||||
return I18N.localise("botany.ceramicBlock");
|
return tileMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
public String getBlockName(ItemStack itemStack) {
|
||||||
int meta = TileEntityMetadata.getItemDamage(stack);
|
return I18N.localise("botany.ceramicBlock");
|
||||||
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
||||||
dropBlockAsItem(world, x, y, z, itemStack);
|
int meta = TileEntityMetadata.getItemDamage(stack);
|
||||||
}
|
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tabs, List itemList) {
|
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
dropBlockAsItem(world, x, y, z, itemStack);
|
||||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public void getSubBlocks(Item item, CreativeTabs tabs, List itemList) {
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||||
if (tile != null) {
|
}
|
||||||
return getIcon(side, tile.getTileMetadata());
|
}
|
||||||
}
|
|
||||||
return super.getIcon(world, x, y, z, side);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(int side, int meta) {
|
@SideOnly(Side.CLIENT)
|
||||||
return blockIcon;
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
}
|
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||||
|
if (tile != null) {
|
||||||
|
return getIcon(side, tile.getTileMetadata());
|
||||||
|
}
|
||||||
|
return super.getIcon(world, x, y, z, side);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public IIcon getIcon(int side, int meta) {
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
return blockIcon;
|
||||||
blockIcon = Botany.proxy.getIcon(register, "ceramic");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
blockIcon = Botany.proxy.getIcon(register, "ceramic");
|
||||||
if (tile != null) {
|
}
|
||||||
return getRenderColor(tile.getTileMetadata());
|
|
||||||
}
|
|
||||||
return 0xffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
@SideOnly(Side.CLIENT)
|
||||||
super.breakBlock(world, x, y, z, block, side);
|
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||||
world.removeTileEntity(x, y, z);
|
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||||
}
|
if (tile != null) {
|
||||||
|
return getRenderColor(tile.getTileMetadata());
|
||||||
|
}
|
||||||
|
return 0xffffff;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
super.breakBlock(world, x, y, z, block, side);
|
||||||
}
|
world.removeTileEntity(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||||
public int getRenderColor(int meta) {
|
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||||
return EnumFlowerColor.get(meta).getColor(false);
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getRenderColor(int meta) {
|
||||||
|
return EnumFlowerColor.get(meta).getColor(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,5 +1,11 @@
|
|||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
|
||||||
import binnie.botany.CreativeTabBotany;
|
import binnie.botany.CreativeTabBotany;
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
import binnie.core.block.TileEntityMetadata;
|
import binnie.core.block.TileEntityMetadata;
|
||||||
@@ -8,35 +14,35 @@ import binnie.extratrees.api.IDesign;
|
|||||||
import binnie.extratrees.carpentry.BlockDesign;
|
import binnie.extratrees.carpentry.BlockDesign;
|
||||||
import binnie.extratrees.carpentry.DesignBlock;
|
import binnie.extratrees.carpentry.DesignBlock;
|
||||||
import binnie.extratrees.carpentry.ModuleCarpentry;
|
import binnie.extratrees.carpentry.ModuleCarpentry;
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class BlockCeramicPatterned extends BlockDesign {
|
public class BlockCeramicPatterned extends BlockDesign {
|
||||||
public BlockCeramicPatterned() {
|
|
||||||
super(CeramicDesignSystem.instance, Material.rock);
|
|
||||||
setHardness(1.0f);
|
|
||||||
setResistance(5.0f);
|
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
setBlockName("ceramicPattern");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public BlockCeramicPatterned() {
|
||||||
public ItemStack getCreativeStack(IDesign design) {
|
super(CeramicDesignSystem.instance, Material.rock);
|
||||||
return ModuleCarpentry.getItemStack(this, CeramicColor.get(EnumFlowerColor.WHITE), CeramicColor.get(EnumFlowerColor.BLACK), design);
|
setHardness(1.0f);
|
||||||
}
|
setResistance(5.0f);
|
||||||
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
setBlockName("ceramicPattern");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBlockName(DesignBlock design) {
|
public ItemStack getCreativeStack(IDesign design) {
|
||||||
return I18N.localise("botany.ceramicBlock");
|
return ModuleCarpentry.getItemStack(
|
||||||
}
|
this,
|
||||||
|
CeramicColor.get(EnumFlowerColor.WHITE),
|
||||||
|
CeramicColor.get(EnumFlowerColor.BLACK),
|
||||||
|
design);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
public String getBlockName(DesignBlock design) {
|
||||||
super.addBlockTooltip(stack, tooltip);
|
return I18N.localise("botany.ceramicBlock");
|
||||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack));
|
}
|
||||||
tooltip.add(EnumChatFormatting.GRAY + block.getDesign().getName());
|
|
||||||
}
|
@Override
|
||||||
|
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
||||||
|
super.addBlockTooltip(stack, tooltip);
|
||||||
|
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack));
|
||||||
|
tooltip.add(EnumChatFormatting.GRAY + block.getDesign().getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,9 @@
|
|||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import java.util.ArrayList;
|
||||||
import binnie.botany.CreativeTabBotany;
|
import java.util.List;
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
import java.util.Random;
|
||||||
import binnie.core.block.BlockMetadata;
|
|
||||||
import binnie.core.block.IBlockMetadata;
|
|
||||||
import binnie.core.block.TileEntityMetadata;
|
|
||||||
import binnie.core.util.I18N;
|
|
||||||
import binnie.extratrees.ExtraTrees;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -25,173 +19,180 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import binnie.botany.Botany;
|
||||||
import java.util.List;
|
import binnie.botany.CreativeTabBotany;
|
||||||
import java.util.Random;
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.core.block.BlockMetadata;
|
||||||
|
import binnie.core.block.IBlockMetadata;
|
||||||
|
import binnie.core.block.TileEntityMetadata;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
import binnie.extratrees.ExtraTrees;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockStained extends Block implements IBlockMetadata {
|
public class BlockStained extends Block implements IBlockMetadata {
|
||||||
public BlockStained() {
|
|
||||||
super(Material.glass);
|
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
setBlockName("stained");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public BlockStained() {
|
||||||
public int quantityDropped(Random rand) {
|
super(Material.glass);
|
||||||
return 0;
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
}
|
setBlockName("stained");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public int quantityDropped(Random rand) {
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public boolean renderAsNormalBlock() {
|
||||||
public int getRenderBlockPass() {
|
return false;
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
public int getRenderBlockPass() {
|
||||||
// Block block2 = world.getBlock(x - Facing.offsetsXForSide[side], y - Facing.offsetsYForSide[side], z - Facing.offsetsZForSide[side]);
|
return 1;
|
||||||
Block block = world.getBlock(x, y, z);
|
}
|
||||||
return block != this
|
|
||||||
&& block != ExtraTrees.blockStained
|
|
||||||
&& super.shouldSideBeRendered(world, x, y, z, side);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
@SideOnly(Side.CLIENT)
|
||||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
}
|
// Block block2 = world.getBlock(x - Facing.offsetsXForSide[side], y - Facing.offsetsYForSide[side], z -
|
||||||
|
// Facing.offsetsZForSide[side]);
|
||||||
|
Block block = world.getBlock(x, y, z);
|
||||||
|
return block != this && block != ExtraTrees.blockStained && super.shouldSideBeRendered(world, x, y, z, side);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World var1, int i) {
|
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||||
return new TileEntityMetadata();
|
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasTileEntity(int meta) {
|
public TileEntity createNewTileEntity(World var1, int i) {
|
||||||
return true;
|
return new TileEntityMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
public boolean hasTileEntity(int meta) {
|
||||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
return true;
|
||||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
}
|
||||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||||
return TileEntityMetadata.getItemDamage(itemStack);
|
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||||
}
|
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||||
|
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||||
return tileMeta;
|
return TileEntityMetadata.getItemDamage(itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBlockName(ItemStack itemStack) {
|
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||||
return I18N.localise("botany.pigmentedGlass");
|
return tileMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
public String getBlockName(ItemStack itemStack) {
|
||||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
return I18N.localise("botany.pigmentedGlass");
|
||||||
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dropAsStack(World world, int x, int y, int z, ItemStack stack) {
|
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||||
dropBlockAsItem(world, x, y, z, stack);
|
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||||
}
|
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List itemList) {
|
public void dropAsStack(World world, int x, int y, int z, ItemStack stack) {
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
dropBlockAsItem(world, x, y, z, stack);
|
||||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public void getSubBlocks(Item item, CreativeTabs tab, List itemList) {
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||||
if (tile != null) {
|
}
|
||||||
return getIcon(side, tile.getTileMetadata());
|
}
|
||||||
}
|
|
||||||
return super.getIcon(world, x, y, z, side);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(int side, int meta) {
|
@SideOnly(Side.CLIENT)
|
||||||
return blockIcon;
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
}
|
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||||
|
if (tile != null) {
|
||||||
|
return getIcon(side, tile.getTileMetadata());
|
||||||
|
}
|
||||||
|
return super.getIcon(world, x, y, z, side);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public IIcon getIcon(int side, int meta) {
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
return blockIcon;
|
||||||
blockIcon = Botany.proxy.getIcon(register, "stained");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
blockIcon = Botany.proxy.getIcon(register, "stained");
|
||||||
if (tile != null) {
|
}
|
||||||
return getRenderColor(tile.getTileMetadata());
|
|
||||||
}
|
|
||||||
return 0xffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
@SideOnly(Side.CLIENT)
|
||||||
super.breakBlock(world, x, y, z, block, side);
|
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||||
world.removeTileEntity(x, y, z);
|
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||||
}
|
if (tile != null) {
|
||||||
|
return getRenderColor(tile.getTileMetadata());
|
||||||
|
}
|
||||||
|
return 0xffffff;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||||
return true;
|
super.breakBlock(world, x, y, z, block, side);
|
||||||
}
|
world.removeTileEntity(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
||||||
return 20;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||||
return true;
|
return 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||||
return 5;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||||
public int getRenderColor(int meta) {
|
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||||
return EnumFlowerColor.get(meta).getColor(false);
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getRenderColor(int meta) {
|
||||||
|
return EnumFlowerColor.get(meta).getColor(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,46 +1,48 @@
|
|||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
import binnie.core.block.TileEntityMetadata;
|
import binnie.core.block.TileEntityMetadata;
|
||||||
import binnie.extratrees.api.IDesignMaterial;
|
import binnie.extratrees.api.IDesignMaterial;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class CeramicColor implements IDesignMaterial {
|
public class CeramicColor implements IDesignMaterial {
|
||||||
private static Map<EnumFlowerColor, CeramicColor> map;
|
|
||||||
|
|
||||||
static {
|
private static Map<EnumFlowerColor, CeramicColor> map;
|
||||||
CeramicColor.map = new LinkedHashMap<>();
|
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
|
||||||
CeramicColor.map.put(c, new CeramicColor(c));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected EnumFlowerColor color;
|
static {
|
||||||
|
CeramicColor.map = new LinkedHashMap<>();
|
||||||
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
|
CeramicColor.map.put(c, new CeramicColor(c));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CeramicColor(EnumFlowerColor color) {
|
protected EnumFlowerColor color;
|
||||||
this.color = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CeramicColor get(EnumFlowerColor c) {
|
CeramicColor(EnumFlowerColor color) {
|
||||||
return CeramicColor.map.get(c);
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public static CeramicColor get(EnumFlowerColor c) {
|
||||||
public ItemStack getStack() {
|
return CeramicColor.map.get(c);
|
||||||
return TileEntityMetadata.getItemStack(Botany.ceramic, color.ordinal());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public ItemStack getStack() {
|
||||||
return color.getName();
|
return TileEntityMetadata.getItemStack(Botany.ceramic, color.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getColor() {
|
public String getName() {
|
||||||
return color.getColor(false);
|
return color.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getColor() {
|
||||||
|
return color.getColor(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,13 @@
|
|||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
import binnie.botany.items.BotanyItems;
|
import binnie.botany.items.BotanyItems;
|
||||||
@@ -10,85 +18,89 @@ import binnie.extratrees.api.IDesignSystem;
|
|||||||
import binnie.extratrees.api.IPattern;
|
import binnie.extratrees.api.IPattern;
|
||||||
import binnie.extratrees.carpentry.DesignerManager;
|
import binnie.extratrees.carpentry.DesignerManager;
|
||||||
import binnie.extratrees.carpentry.EnumPattern;
|
import binnie.extratrees.carpentry.EnumPattern;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class CeramicDesignSystem implements IDesignSystem {
|
public class CeramicDesignSystem implements IDesignSystem {
|
||||||
public static CeramicDesignSystem instance = new CeramicDesignSystem();
|
|
||||||
|
|
||||||
protected Map<Integer, IIcon> primary;
|
public static CeramicDesignSystem instance = new CeramicDesignSystem();
|
||||||
protected Map<Integer, IIcon> secondary;
|
|
||||||
|
|
||||||
CeramicDesignSystem() {
|
protected Map<Integer, IIcon> primary;
|
||||||
primary = new HashMap<>();
|
protected Map<Integer, IIcon> secondary;
|
||||||
secondary = new HashMap<>();
|
|
||||||
DesignerManager.instance.registerDesignSystem(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
CeramicDesignSystem() {
|
||||||
public IDesignMaterial getDefaultMaterial() {
|
primary = new HashMap<>();
|
||||||
return CeramicColor.get(EnumFlowerColor.WHITE);
|
secondary = new HashMap<>();
|
||||||
}
|
DesignerManager.instance.registerDesignSystem(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IDesignMaterial getDefaultMaterial2() {
|
public IDesignMaterial getDefaultMaterial() {
|
||||||
return CeramicColor.get(EnumFlowerColor.BLACK);
|
return CeramicColor.get(EnumFlowerColor.WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IDesignMaterial getMaterial(int id) {
|
public IDesignMaterial getDefaultMaterial2() {
|
||||||
return CeramicColor.get(EnumFlowerColor.get(id));
|
return CeramicColor.get(EnumFlowerColor.BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaterialIndex(IDesignMaterial id) {
|
public IDesignMaterial getMaterial(int id) {
|
||||||
return ((CeramicColor) id).color.ordinal();
|
return CeramicColor.get(EnumFlowerColor.get(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTexturePath() {
|
@Override
|
||||||
return "ceramic";
|
public int getMaterialIndex(IDesignMaterial id) {
|
||||||
}
|
return ((CeramicColor) id).color.ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
public String getTexturePath() {
|
||||||
public IIcon getPrimaryIcon(IPattern pattern) {
|
return "ceramic";
|
||||||
if (pattern instanceof EnumPattern) {
|
}
|
||||||
return primary.get(((EnumPattern) pattern).ordinal());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getSecondaryIcon(IPattern pattern) {
|
public IIcon getPrimaryIcon(IPattern pattern) {
|
||||||
if (pattern instanceof EnumPattern) {
|
if (pattern instanceof EnumPattern) {
|
||||||
return secondary.get(((EnumPattern) pattern).ordinal());
|
return primary.get(((EnumPattern) pattern).ordinal());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerIcons(IIconRegister register) {
|
public IIcon getSecondaryIcon(IPattern pattern) {
|
||||||
for (EnumPattern pattern : EnumPattern.values()) {
|
if (pattern instanceof EnumPattern) {
|
||||||
primary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, getMod().getModID(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0"));
|
return secondary.get(((EnumPattern) pattern).ordinal());
|
||||||
secondary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, getMod().getModID(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1"));
|
}
|
||||||
}
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractMod getMod() {
|
@Override
|
||||||
return Botany.instance;
|
public void registerIcons(IIconRegister register) {
|
||||||
}
|
for (EnumPattern pattern : EnumPattern.values()) {
|
||||||
|
primary.put(
|
||||||
|
pattern.ordinal(),
|
||||||
|
BinnieCore.proxy.getIcon(
|
||||||
|
register,
|
||||||
|
getMod().getModID(),
|
||||||
|
getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0"));
|
||||||
|
secondary.put(
|
||||||
|
pattern.ordinal(),
|
||||||
|
BinnieCore.proxy.getIcon(
|
||||||
|
register,
|
||||||
|
getMod().getModID(),
|
||||||
|
getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
public AbstractMod getMod() {
|
||||||
public ItemStack getAdhesive() {
|
return Botany.instance;
|
||||||
return BotanyItems.Mortar.get(1);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IDesignMaterial getMaterial(ItemStack stack) {
|
public ItemStack getAdhesive() {
|
||||||
return (stack.getItem() == Item.getItemFromBlock(Botany.ceramic)) ? getMaterial(stack.getItemDamage()) : null;
|
return BotanyItems.Mortar.get(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IDesignMaterial getMaterial(ItemStack stack) {
|
||||||
|
return (stack.getItem() == Item.getItemFromBlock(Botany.ceramic)) ? getMaterial(stack.getItemDamage()) : null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,71 +1,73 @@
|
|||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import binnie.botany.Botany;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CeramicTileRecipe implements IRecipe {
|
public class CeramicTileRecipe implements IRecipe {
|
||||||
protected ItemStack cached;
|
|
||||||
|
|
||||||
@Override
|
protected ItemStack cached;
|
||||||
public boolean matches(InventoryCrafting crafting, World world) {
|
|
||||||
cached = getCraftingResult(crafting);
|
|
||||||
return cached != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
public boolean matches(InventoryCrafting crafting, World world) {
|
||||||
Item ceramicBlock = Item.getItemFromBlock(Botany.ceramic);
|
cached = getCraftingResult(crafting);
|
||||||
Item ceramicTile = Item.getItemFromBlock(Botany.ceramicTile);
|
return cached != null;
|
||||||
Item ceramicBrick = Item.getItemFromBlock(Botany.ceramicBrick);
|
}
|
||||||
Item mortar = Botany.misc;
|
|
||||||
List<ItemStack> stacks = new ArrayList<>();
|
|
||||||
int ix = -1;
|
|
||||||
int iy = -1;
|
|
||||||
|
|
||||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
@Override
|
||||||
ItemStack stack = inv.getStackInSlot(i);
|
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||||
if (stack != null) {
|
Item ceramicBlock = Item.getItemFromBlock(Botany.ceramic);
|
||||||
int x = i / 3;
|
Item ceramicTile = Item.getItemFromBlock(Botany.ceramicTile);
|
||||||
int y = i % 3;
|
Item ceramicBrick = Item.getItemFromBlock(Botany.ceramicBrick);
|
||||||
if (ix == -1) {
|
Item mortar = Botany.misc;
|
||||||
ix = x;
|
List<ItemStack> stacks = new ArrayList<>();
|
||||||
iy = y;
|
int ix = -1;
|
||||||
}
|
int iy = -1;
|
||||||
if (x - ix >= 2 || y - iy >= 2 || y < iy || x < ix) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Item item = stack.getItem();
|
|
||||||
if (item != ceramicBlock && item != ceramicTile && item != ceramicBrick && item != mortar) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
stacks.add(stack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.values()) {
|
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||||
ItemStack stack2 = type.getRecipe(stacks);
|
ItemStack stack = inv.getStackInSlot(i);
|
||||||
if (stack2 != null) {
|
if (stack != null) {
|
||||||
return stack2;
|
int x = i / 3;
|
||||||
}
|
int y = i % 3;
|
||||||
}
|
if (ix == -1) {
|
||||||
return null;
|
ix = x;
|
||||||
}
|
iy = y;
|
||||||
|
}
|
||||||
|
if (x - ix >= 2 || y - iy >= 2 || y < iy || x < ix) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
Item item = stack.getItem();
|
||||||
public int getRecipeSize() {
|
if (item != ceramicBlock && item != ceramicTile && item != ceramicBrick && item != mortar) {
|
||||||
return 2;
|
return null;
|
||||||
}
|
}
|
||||||
|
stacks.add(stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
for (BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.values()) {
|
||||||
public ItemStack getRecipeOutput() {
|
ItemStack stack2 = type.getRecipe(stacks);
|
||||||
return cached;
|
if (stack2 != null) {
|
||||||
}
|
return stack2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRecipeSize() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getRecipeOutput() {
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,59 +1,61 @@
|
|||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
import binnie.Binnie;
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
import binnie.botany.api.IFlower;
|
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import binnie.Binnie;
|
||||||
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.api.IFlower;
|
||||||
|
|
||||||
public class PigmentRecipe implements IRecipe {
|
public class PigmentRecipe implements IRecipe {
|
||||||
protected ItemStack cached;
|
|
||||||
|
|
||||||
private ItemStack unknown;
|
protected ItemStack cached;
|
||||||
|
|
||||||
public PigmentRecipe() {
|
private ItemStack unknown;
|
||||||
unknown = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public PigmentRecipe() {
|
||||||
public boolean matches(InventoryCrafting crafting, World world) {
|
unknown = null;
|
||||||
return getCraftingResult(crafting) != null;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getRecipeOutput() {
|
public boolean matches(InventoryCrafting crafting, World world) {
|
||||||
if (cached != null) {
|
return getCraftingResult(crafting) != null;
|
||||||
return cached;
|
}
|
||||||
}
|
|
||||||
return unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getCraftingResult(InventoryCrafting crafting) {
|
public ItemStack getRecipeOutput() {
|
||||||
int n = 0;
|
if (cached != null) {
|
||||||
ItemStack stack = null;
|
return cached;
|
||||||
for (int i = 0; i < crafting.getSizeInventory(); ++i) {
|
}
|
||||||
if (crafting.getStackInSlot(i) != null) {
|
return unknown;
|
||||||
if (++n > 1) {
|
}
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!Binnie.Genetics.getFlowerRoot().isMember(crafting.getStackInSlot(i))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(crafting.getStackInSlot(i));
|
@Override
|
||||||
if (flower.getAge() >= 1) {
|
public ItemStack getCraftingResult(InventoryCrafting crafting) {
|
||||||
stack = new ItemStack(Botany.pigment, 1, flower.getGenome().getPrimaryColor().getID());
|
int n = 0;
|
||||||
}
|
ItemStack stack = null;
|
||||||
}
|
for (int i = 0; i < crafting.getSizeInventory(); ++i) {
|
||||||
}
|
if (crafting.getStackInSlot(i) != null) {
|
||||||
return stack;
|
if (++n > 1) {
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
if (!Binnie.Genetics.getFlowerRoot().isMember(crafting.getStackInSlot(i))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(crafting.getStackInSlot(i));
|
||||||
public int getRecipeSize() {
|
if (flower.getAge() >= 1) {
|
||||||
return 1;
|
stack = new ItemStack(Botany.pigment, 1, flower.getGenome().getPrimaryColor().getID());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRecipeSize() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,9 +4,10 @@ import binnie.botany.api.IFlowerRoot;
|
|||||||
import binnie.botany.genetics.FlowerHelper;
|
import binnie.botany.genetics.FlowerHelper;
|
||||||
|
|
||||||
public class BotanyCore {
|
public class BotanyCore {
|
||||||
public static IFlowerRoot speciesRoot = new FlowerHelper();
|
|
||||||
|
|
||||||
public static IFlowerRoot getFlowerRoot() {
|
public static IFlowerRoot speciesRoot = new FlowerHelper();
|
||||||
return BotanyCore.speciesRoot;
|
|
||||||
}
|
public static IFlowerRoot getFlowerRoot() {
|
||||||
|
return BotanyCore.speciesRoot;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,26 +1,28 @@
|
|||||||
package binnie.botany.core;
|
package binnie.botany.core;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import binnie.botany.craftgui.WindowBotanistDatabase;
|
import binnie.botany.craftgui.WindowBotanistDatabase;
|
||||||
import binnie.core.craftgui.minecraft.Window;
|
import binnie.core.craftgui.minecraft.Window;
|
||||||
import binnie.core.gui.IBinnieGUID;
|
import binnie.core.gui.IBinnieGUID;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public enum BotanyGUI implements IBinnieGUID {
|
public enum BotanyGUI implements IBinnieGUID {
|
||||||
Database,
|
|
||||||
DatabaseNEI;
|
|
||||||
|
|
||||||
@Override
|
Database,
|
||||||
public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side) {
|
DatabaseNEI;
|
||||||
Window window = null;
|
|
||||||
switch (this) {
|
@Override
|
||||||
case Database:
|
public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side) {
|
||||||
case DatabaseNEI: {
|
Window window = null;
|
||||||
window = WindowBotanistDatabase.create(player, side, this != BotanyGUI.Database);
|
switch (this) {
|
||||||
break;
|
case Database:
|
||||||
}
|
case DatabaseNEI: {
|
||||||
}
|
window = WindowBotanistDatabase.create(player, side, this != BotanyGUI.Database);
|
||||||
return window;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return window;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,18 +3,19 @@ package binnie.botany.core;
|
|||||||
import binnie.core.IInitializable;
|
import binnie.core.IInitializable;
|
||||||
|
|
||||||
public class ModuleCore implements IInitializable {
|
public class ModuleCore implements IInitializable {
|
||||||
@Override
|
|
||||||
public void preInit() {
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void preInit() {
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postInit() {
|
public void init() {
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postInit() {
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -11,33 +11,34 @@ import binnie.core.craftgui.controls.core.IControlValue;
|
|||||||
import binnie.core.craftgui.geometry.IArea;
|
import binnie.core.craftgui.geometry.IArea;
|
||||||
|
|
||||||
public class ControlColorDisplay extends Control implements IControlValue<IFlowerColor>, ITooltip {
|
public class ControlColorDisplay extends Control implements IControlValue<IFlowerColor>, ITooltip {
|
||||||
private IFlowerColor value;
|
|
||||||
|
|
||||||
public ControlColorDisplay(IWidget parent, float x, float y) {
|
private IFlowerColor value;
|
||||||
super(parent, x, y, 16.0f, 16.0f);
|
|
||||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ControlColorDisplay(IWidget parent, float x, float y) {
|
||||||
public IFlowerColor getValue() {
|
super(parent, x, y, 16.0f, 16.0f);
|
||||||
return value;
|
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValue(IFlowerColor value) {
|
public IFlowerColor getValue() {
|
||||||
this.value = value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRenderBackground() {
|
public void setValue(IFlowerColor value) {
|
||||||
IArea area = getArea();
|
this.value = value;
|
||||||
CraftGUI.render.solid(area, -1);
|
}
|
||||||
CraftGUI.render.solid(area.inset(1), 0xff000000 + getValue().getColor(false));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getTooltip(Tooltip tooltip) {
|
public void onRenderBackground() {
|
||||||
super.getTooltip(tooltip);
|
IArea area = getArea();
|
||||||
tooltip.add(value.getName());
|
CraftGUI.render.solid(area, -1);
|
||||||
}
|
CraftGUI.render.solid(area.inset(1), 0xff000000 + getValue().getColor(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getTooltip(Tooltip tooltip) {
|
||||||
|
super.getTooltip(tooltip);
|
||||||
|
tooltip.add(value.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,20 +5,21 @@ import binnie.core.craftgui.IWidget;
|
|||||||
import binnie.core.craftgui.controls.listbox.ControlListBox;
|
import binnie.core.craftgui.controls.listbox.ControlListBox;
|
||||||
|
|
||||||
public class ControlColorMixBox extends ControlListBox<IColourMix> {
|
public class ControlColorMixBox extends ControlListBox<IColourMix> {
|
||||||
private Type type;
|
|
||||||
|
|
||||||
public ControlColorMixBox(IWidget parent, int x, int y, int width, int height, Type type) {
|
private Type type;
|
||||||
super(parent, x, y, width, height, 12.0f);
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ControlColorMixBox(IWidget parent, int x, int y, int width, int height, Type type) {
|
||||||
public IWidget createOption(IColourMix value, int y) {
|
super(parent, x, y, width, height, 12.0f);
|
||||||
return new ControlColorMixItem(getContent(), value, y);
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Type {
|
@Override
|
||||||
Resultant,
|
public IWidget createOption(IColourMix value, int y) {
|
||||||
Further
|
return new ControlColorMixItem(getContent(), value, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum Type {
|
||||||
|
Resultant,
|
||||||
|
Further
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,26 +5,27 @@ import binnie.core.craftgui.controls.listbox.ControlList;
|
|||||||
import binnie.core.craftgui.controls.listbox.ControlOption;
|
import binnie.core.craftgui.controls.listbox.ControlOption;
|
||||||
|
|
||||||
public class ControlColorMixItem extends ControlOption<IColourMix> {
|
public class ControlColorMixItem extends ControlOption<IColourMix> {
|
||||||
protected ControlColorDisplay itemWidget1;
|
|
||||||
protected ControlColorDisplay itemWidget2;
|
|
||||||
protected ControlColorDisplay itemWidget3;
|
|
||||||
protected ControlColourMixSymbol addSymbol;
|
|
||||||
protected ControlColourMixSymbol arrowSymbol;
|
|
||||||
|
|
||||||
public ControlColorMixItem(ControlList<IColourMix> controlList, IColourMix option, int y) {
|
protected ControlColorDisplay itemWidget1;
|
||||||
super(controlList, option, y);
|
protected ControlColorDisplay itemWidget2;
|
||||||
itemWidget1 = new ControlColorDisplay(this, 4.0f, 4.0f);
|
protected ControlColorDisplay itemWidget3;
|
||||||
itemWidget2 = new ControlColorDisplay(this, 44.0f, 4.0f);
|
protected ControlColourMixSymbol addSymbol;
|
||||||
itemWidget3 = new ControlColorDisplay(this, 104.0f, 4.0f);
|
protected ControlColourMixSymbol arrowSymbol;
|
||||||
addSymbol = new ControlColourMixSymbol(this, 24, 4, 0);
|
|
||||||
arrowSymbol = new ControlColourMixSymbol(this, 64, 4, 1);
|
|
||||||
|
|
||||||
if (getValue() != null) {
|
public ControlColorMixItem(ControlList<IColourMix> controlList, IColourMix option, int y) {
|
||||||
itemWidget1.setValue(getValue().getColor1());
|
super(controlList, option, y);
|
||||||
itemWidget2.setValue(getValue().getColor2());
|
itemWidget1 = new ControlColorDisplay(this, 4.0f, 4.0f);
|
||||||
itemWidget3.setValue(getValue().getResult());
|
itemWidget2 = new ControlColorDisplay(this, 44.0f, 4.0f);
|
||||||
addSymbol.setValue(getValue());
|
itemWidget3 = new ControlColorDisplay(this, 104.0f, 4.0f);
|
||||||
arrowSymbol.setValue(getValue());
|
addSymbol = new ControlColourMixSymbol(this, 24, 4, 0);
|
||||||
}
|
arrowSymbol = new ControlColourMixSymbol(this, 64, 4, 1);
|
||||||
}
|
|
||||||
|
if (getValue() != null) {
|
||||||
|
itemWidget1.setValue(getValue().getColor1());
|
||||||
|
itemWidget2.setValue(getValue().getColor2());
|
||||||
|
itemWidget3.setValue(getValue().getResult());
|
||||||
|
addSymbol.setValue(getValue());
|
||||||
|
arrowSymbol.setValue(getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -9,20 +9,21 @@ import binnie.core.craftgui.geometry.CraftGUIUtil;
|
|||||||
import binnie.core.craftgui.geometry.IPoint;
|
import binnie.core.craftgui.geometry.IPoint;
|
||||||
|
|
||||||
public class ControlColorOption extends ControlTextOption<IFlowerColor> {
|
public class ControlColorOption extends ControlTextOption<IFlowerColor> {
|
||||||
protected ControlColorDisplay controlBee;
|
|
||||||
protected IPoint boxPosition;
|
|
||||||
|
|
||||||
public ControlColorOption(ControlList<IFlowerColor> controlList, IFlowerColor option, int y) {
|
protected ControlColorDisplay controlBee;
|
||||||
super(controlList, option, option.getName(), y);
|
protected IPoint boxPosition;
|
||||||
setSize(new IPoint(getSize().x(), 20.0f));
|
|
||||||
(controlBee = new ControlColorDisplay(this, 2.0f, 2.0f)).setValue(option);
|
public ControlColorOption(ControlList<IFlowerColor> controlList, IFlowerColor option, int y) {
|
||||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
super(controlList, option, option.getName(), y);
|
||||||
CraftGUIUtil.moveWidget(textWidget, new IPoint(22.0f, 0.0f));
|
setSize(new IPoint(getSize().x(), 20.0f));
|
||||||
textWidget.setSize(textWidget.getSize().sub(new IPoint(24.0f, 0.0f)));
|
(controlBee = new ControlColorDisplay(this, 2.0f, 2.0f)).setValue(option);
|
||||||
int th = (int) CraftGUI.render.textHeight(textWidget.getValue(), textWidget.getSize().x());
|
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||||
int height = Math.max(20, th + 6);
|
CraftGUIUtil.moveWidget(textWidget, new IPoint(22.0f, 0.0f));
|
||||||
setSize(new IPoint(size().x(), height));
|
textWidget.setSize(textWidget.getSize().sub(new IPoint(24.0f, 0.0f)));
|
||||||
textWidget.setSize(new IPoint(textWidget.getSize().x(), height));
|
int th = (int) CraftGUI.render.textHeight(textWidget.getValue(), textWidget.getSize().x());
|
||||||
boxPosition = new IPoint(2.0f, (height - 18) / 2);
|
int height = Math.max(20, th + 6);
|
||||||
}
|
setSize(new IPoint(size().x(), height));
|
||||||
|
textWidget.setSize(new IPoint(textWidget.getSize().x(), height));
|
||||||
|
boxPosition = new IPoint(2.0f, (height - 18) / 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -14,39 +14,40 @@ import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
|||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
public class ControlColourMixSymbol extends Control implements ITooltip {
|
public class ControlColourMixSymbol extends Control implements ITooltip {
|
||||||
protected static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2);
|
|
||||||
protected static Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.Controls2);
|
|
||||||
|
|
||||||
protected IColourMix value;
|
protected static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2);
|
||||||
protected int type;
|
protected static Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.Controls2);
|
||||||
|
|
||||||
protected ControlColourMixSymbol(IWidget parent, int x, int y, int type) {
|
protected IColourMix value;
|
||||||
super(parent, x, y, 16 + type * 16, 16.0f);
|
protected int type;
|
||||||
this.type = type;
|
|
||||||
value = null;
|
|
||||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
protected ControlColourMixSymbol(IWidget parent, int x, int y, int type) {
|
||||||
public void onRenderBackground() {
|
super(parent, x, y, 16 + type * 16, 16.0f);
|
||||||
super.onRenderBackground();
|
this.type = type;
|
||||||
if (type == 0) {
|
value = null;
|
||||||
CraftGUI.render.texture(ControlColourMixSymbol.MutationPlus, IPoint.ZERO);
|
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||||
} else {
|
}
|
||||||
CraftGUI.render.texture(ControlColourMixSymbol.MutationArrow, IPoint.ZERO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(IColourMix value) {
|
@Override
|
||||||
this.value = value;
|
public void onRenderBackground() {
|
||||||
setColor(0xffffff);
|
super.onRenderBackground();
|
||||||
}
|
if (type == 0) {
|
||||||
|
CraftGUI.render.texture(ControlColourMixSymbol.MutationPlus, IPoint.ZERO);
|
||||||
|
} else {
|
||||||
|
CraftGUI.render.texture(ControlColourMixSymbol.MutationArrow, IPoint.ZERO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
public void setValue(IColourMix value) {
|
||||||
public void getTooltip(Tooltip tooltip) {
|
this.value = value;
|
||||||
if (type == 1) {
|
setColor(0xffffff);
|
||||||
float chance = value.getChance();
|
}
|
||||||
tooltip.add(I18N.localise("botany.gui.controls.colorMixSymbol.chance", chance));
|
|
||||||
}
|
@Override
|
||||||
}
|
public void getTooltip(Tooltip tooltip) {
|
||||||
|
if (type == 1) {
|
||||||
|
float chance = value.getChance();
|
||||||
|
tooltip.add(I18N.localise("botany.gui.controls.colorMixSymbol.chance", chance));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
package binnie.botany.craftgui;
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import binnie.botany.api.IColourMix;
|
import binnie.botany.api.IColourMix;
|
||||||
import binnie.botany.api.IFlowerColor;
|
import binnie.botany.api.IFlowerColor;
|
||||||
import binnie.botany.core.BotanyCore;
|
import binnie.botany.core.BotanyCore;
|
||||||
@@ -10,27 +13,25 @@ import binnie.core.craftgui.database.DatabaseTab;
|
|||||||
import binnie.core.craftgui.database.PageAbstract;
|
import binnie.core.craftgui.database.PageAbstract;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class PageColorMix extends PageAbstract<IFlowerColor> {
|
public class PageColorMix extends PageAbstract<IFlowerColor> {
|
||||||
ControlText title;
|
|
||||||
ControlColorMixBox list;
|
|
||||||
|
|
||||||
public PageColorMix(IWidget parent, DatabaseTab tab) {
|
ControlText title;
|
||||||
super(parent, tab);
|
ControlColorMixBox list;
|
||||||
title = new ControlTextCentered(this, 8.0f, I18N.localise("botany.gui.controls.pageColorFurtherTitle"));
|
|
||||||
list = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.Further);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public PageColorMix(IWidget parent, DatabaseTab tab) {
|
||||||
public void onValueChanged(IFlowerColor colour) {
|
super(parent, tab);
|
||||||
List<IColourMix> mixes = new ArrayList<>();
|
title = new ControlTextCentered(this, 8.0f, I18N.localise("botany.gui.controls.pageColorFurtherTitle"));
|
||||||
for (IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
list = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.Further);
|
||||||
if (mix.getColor1() == colour || mix.getColor2() == colour) {
|
}
|
||||||
mixes.add(mix);
|
|
||||||
}
|
@Override
|
||||||
}
|
public void onValueChanged(IFlowerColor colour) {
|
||||||
list.setOptions(mixes);
|
List<IColourMix> mixes = new ArrayList<>();
|
||||||
}
|
for (IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
||||||
|
if (mix.getColor1() == colour || mix.getColor2() == colour) {
|
||||||
|
mixes.add(mix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.setOptions(mixes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
package binnie.botany.craftgui;
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import binnie.botany.api.IColourMix;
|
import binnie.botany.api.IColourMix;
|
||||||
import binnie.botany.api.IFlowerColor;
|
import binnie.botany.api.IFlowerColor;
|
||||||
import binnie.botany.core.BotanyCore;
|
import binnie.botany.core.BotanyCore;
|
||||||
@@ -10,27 +13,25 @@ import binnie.core.craftgui.database.DatabaseTab;
|
|||||||
import binnie.core.craftgui.database.PageAbstract;
|
import binnie.core.craftgui.database.PageAbstract;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class PageColorMixResultant extends PageAbstract<IFlowerColor> {
|
public class PageColorMixResultant extends PageAbstract<IFlowerColor> {
|
||||||
protected ControlText title;
|
|
||||||
protected ControlColorMixBox list;
|
|
||||||
|
|
||||||
public PageColorMixResultant(IWidget parent, DatabaseTab tab) {
|
protected ControlText title;
|
||||||
super(parent, tab);
|
protected ControlColorMixBox list;
|
||||||
title = new ControlTextCentered(this, 8.0f, I18N.localise("botany.gui.controls.pageSpeciesFurtherTitle"));
|
|
||||||
list = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.Resultant);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public PageColorMixResultant(IWidget parent, DatabaseTab tab) {
|
||||||
public void onValueChanged(IFlowerColor color) {
|
super(parent, tab);
|
||||||
List<IColourMix> mixes = new ArrayList<>();
|
title = new ControlTextCentered(this, 8.0f, I18N.localise("botany.gui.controls.pageSpeciesFurtherTitle"));
|
||||||
for (IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
list = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.Resultant);
|
||||||
if (mix.getResult() == color) {
|
}
|
||||||
mixes.add(mix);
|
|
||||||
}
|
@Override
|
||||||
}
|
public void onValueChanged(IFlowerColor color) {
|
||||||
list.setOptions(mixes);
|
List<IColourMix> mixes = new ArrayList<>();
|
||||||
}
|
for (IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
||||||
|
if (mix.getResult() == color) {
|
||||||
|
mixes.add(mix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.setOptions(mixes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package binnie.botany.craftgui;
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import binnie.botany.api.EnumFlowerChromosome;
|
import binnie.botany.api.EnumFlowerChromosome;
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
@@ -22,87 +24,143 @@ import binnie.genetics.genetics.AlleleHelper;
|
|||||||
import forestry.api.genetics.IAllele;
|
import forestry.api.genetics.IAllele;
|
||||||
import forestry.api.genetics.IAlleleSpecies;
|
import forestry.api.genetics.IAlleleSpecies;
|
||||||
import forestry.api.genetics.IIndividual;
|
import forestry.api.genetics.IIndividual;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public class PageSpeciesFlowerGenome extends PageSpecies {
|
public class PageSpeciesFlowerGenome extends PageSpecies {
|
||||||
public PageSpeciesFlowerGenome(IWidget parent, DatabaseTab tab) {
|
|
||||||
super(parent, tab);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public PageSpeciesFlowerGenome(IWidget parent, DatabaseTab tab) {
|
||||||
public void onValueChanged(IAlleleSpecies species) {
|
super(parent, tab);
|
||||||
deleteAllChildren();
|
}
|
||||||
IAllele[] template = Binnie.Genetics.getFlowerRoot().getTemplate(species.getUID());
|
|
||||||
if (template == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IFlower tree = Binnie.Genetics.getFlowerRoot().templateAsIndividual(template);
|
@Override
|
||||||
if (tree == null) {
|
public void onValueChanged(IAlleleSpecies species) {
|
||||||
return;
|
deleteAllChildren();
|
||||||
}
|
IAllele[] template = Binnie.Genetics.getFlowerRoot().getTemplate(species.getUID());
|
||||||
|
if (template == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
IFlowerGenome genome = tree.getGenome();
|
IFlower tree = Binnie.Genetics.getFlowerRoot().templateAsIndividual(template);
|
||||||
IAlleleFlowerSpecies treeSpecies = genome.getPrimary();
|
if (tree == null) {
|
||||||
int w = 144;
|
return;
|
||||||
int h = 176;
|
}
|
||||||
|
|
||||||
new ControlText(this, new IArea(0.0f, 4.0f, w, 16.0f), I18N.localise("botany.gui.database.tab.genome"), TextJustification.MIDDLE_CENTER);
|
IFlowerGenome genome = tree.getGenome();
|
||||||
ControlScrollableContent scrollable = new ControlScrollableContent(this, 4.0f, 20.0f, w - 8, h - 8 - 16, 12.0f);
|
IAlleleFlowerSpecies treeSpecies = genome.getPrimary();
|
||||||
Control contents = new Control(scrollable, 0.0f, 0.0f, w - 8 - 12, h - 8 - 16);
|
int w = 144;
|
||||||
|
int h = 176;
|
||||||
|
|
||||||
int tw = w - 8 - 12;
|
new ControlText(
|
||||||
int w2 = 55;
|
this,
|
||||||
int w3 = tw - 50;
|
new IArea(0.0f, 4.0f, w, 16.0f),
|
||||||
int y = 0;
|
I18N.localise("botany.gui.database.tab.genome"),
|
||||||
int th = 14;
|
TextJustification.MIDDLE_CENTER);
|
||||||
int valueX = w2 + 4;
|
ControlScrollableContent scrollable = new ControlScrollableContent(this, 4.0f, 20.0f, w - 8, h - 8 - 16, 12.0f);
|
||||||
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.temp"), TextJustification.MIDDLE_RIGHT);
|
Control contents = new Control(scrollable, 0.0f, 0.0f, w - 8 - 12, h - 8 - 16);
|
||||||
new ControlText(contents, new IArea(valueX, y, w3, th), AlleleHelper.toDisplay(treeSpecies.getTemperature()), TextJustification.MIDDLE_LEFT);
|
|
||||||
y += th;
|
|
||||||
|
|
||||||
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.moist"), TextJustification.MIDDLE_RIGHT);
|
int tw = w - 8 - 12;
|
||||||
new ControlText(contents, new IArea(valueX, y, w3, th), AlleleHelper.toDisplay(treeSpecies.getMoisture()), TextJustification.MIDDLE_LEFT);
|
int w2 = 55;
|
||||||
y += th;
|
int w3 = tw - 50;
|
||||||
|
int y = 0;
|
||||||
|
int th = 14;
|
||||||
|
int valueX = w2 + 4;
|
||||||
|
new ControlText(
|
||||||
|
contents,
|
||||||
|
new IArea(0.0f, y, w2, th),
|
||||||
|
I18N.localise("botany.gui.database.tab.genome.temp"),
|
||||||
|
TextJustification.MIDDLE_RIGHT);
|
||||||
|
new ControlText(
|
||||||
|
contents,
|
||||||
|
new IArea(valueX, y, w3, th),
|
||||||
|
AlleleHelper.toDisplay(treeSpecies.getTemperature()),
|
||||||
|
TextJustification.MIDDLE_LEFT);
|
||||||
|
y += th;
|
||||||
|
|
||||||
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.ph"), TextJustification.MIDDLE_RIGHT);
|
new ControlText(
|
||||||
new ControlText(contents, new IArea(valueX, y, w3, th), AlleleHelper.toDisplay(treeSpecies.getPH()), TextJustification.MIDDLE_LEFT);
|
contents,
|
||||||
y += th;
|
new IArea(0.0f, y, w2, th),
|
||||||
|
I18N.localise("botany.gui.database.tab.genome.moist"),
|
||||||
|
TextJustification.MIDDLE_RIGHT);
|
||||||
|
new ControlText(
|
||||||
|
contents,
|
||||||
|
new IArea(valueX, y, w3, th),
|
||||||
|
AlleleHelper.toDisplay(treeSpecies.getMoisture()),
|
||||||
|
TextJustification.MIDDLE_LEFT);
|
||||||
|
y += th;
|
||||||
|
|
||||||
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.fertility"), TextJustification.MIDDLE_RIGHT);
|
new ControlText(
|
||||||
new ControlText(contents, new IArea(valueX, y, w3, th), genome.getFertility() + "x", TextJustification.MIDDLE_LEFT);
|
contents,
|
||||||
y += th;
|
new IArea(0.0f, y, w2, th),
|
||||||
|
I18N.localise("botany.gui.database.tab.genome.ph"),
|
||||||
|
TextJustification.MIDDLE_RIGHT);
|
||||||
|
new ControlText(
|
||||||
|
contents,
|
||||||
|
new IArea(valueX, y, w3, th),
|
||||||
|
AlleleHelper.toDisplay(treeSpecies.getPH()),
|
||||||
|
TextJustification.MIDDLE_LEFT);
|
||||||
|
y += th;
|
||||||
|
|
||||||
float lifespan = genome.getLifespan() * 68.27f / genome.getAgeChance() / 24000.0f;
|
new ControlText(
|
||||||
String lifespanValue = String.format("%.2f", lifespan);
|
contents,
|
||||||
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.lifespan"), TextJustification.MIDDLE_RIGHT);
|
new IArea(0.0f, y, w2, th),
|
||||||
new ControlText(contents, new IArea(valueX, y, w3, th), I18N.localise("botany.gui.database.tab.genome.lifespan.value", lifespanValue), TextJustification.MIDDLE_LEFT);
|
I18N.localise("botany.gui.database.tab.genome.fertility"),
|
||||||
y += th;
|
TextJustification.MIDDLE_RIGHT);
|
||||||
|
new ControlText(
|
||||||
|
contents,
|
||||||
|
new IArea(valueX, y, w3, th),
|
||||||
|
genome.getFertility() + "x",
|
||||||
|
TextJustification.MIDDLE_LEFT);
|
||||||
|
y += th;
|
||||||
|
|
||||||
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.nectar"), TextJustification.MIDDLE_RIGHT);
|
float lifespan = genome.getLifespan() * 68.27f / genome.getAgeChance() / 24000.0f;
|
||||||
new ControlText(contents, new IArea(valueX, y, w3, th), genome.getActiveAllele(EnumFlowerChromosome.SAPPINESS).getName(), TextJustification.MIDDLE_LEFT);
|
String lifespanValue = String.format("%.2f", lifespan);
|
||||||
y += th;
|
new ControlText(
|
||||||
|
contents,
|
||||||
|
new IArea(0.0f, y, w2, th),
|
||||||
|
I18N.localise("botany.gui.database.tab.genome.lifespan"),
|
||||||
|
TextJustification.MIDDLE_RIGHT);
|
||||||
|
new ControlText(
|
||||||
|
contents,
|
||||||
|
new IArea(valueX, y, w3, th),
|
||||||
|
I18N.localise("botany.gui.database.tab.genome.lifespan.value", lifespanValue),
|
||||||
|
TextJustification.MIDDLE_LEFT);
|
||||||
|
y += th;
|
||||||
|
|
||||||
int x = w2;
|
new ControlText(
|
||||||
int tot = 0;
|
contents,
|
||||||
for (IIndividual vid : BotanyCore.getFlowerRoot().getIndividualTemplates()) {
|
new IArea(0.0f, y, w2, th),
|
||||||
if (vid.getGenome().getPrimary() == treeSpecies) {
|
I18N.localise("botany.gui.database.tab.genome.nectar"),
|
||||||
if (tot > 0 && tot % 3 == 0) {
|
TextJustification.MIDDLE_RIGHT);
|
||||||
x -= 54;
|
new ControlText(
|
||||||
y += 18;
|
contents,
|
||||||
}
|
new IArea(valueX, y, w3, th),
|
||||||
ItemStack stack = BotanyCore.getFlowerRoot().getMemberStack(vid, EnumFlowerStage.FLOWER.ordinal());
|
genome.getActiveAllele(EnumFlowerChromosome.SAPPINESS).getName(),
|
||||||
ControlItemDisplay display = new ControlItemDisplay(contents, x, y);
|
TextJustification.MIDDLE_LEFT);
|
||||||
display.setItemStack(stack);
|
y += th;
|
||||||
tot++;
|
|
||||||
x += 18;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int numOfLines = 1 + (tot - 1) / 3;
|
int x = w2;
|
||||||
new ControlText(contents, new IArea(0.0f, y - (numOfLines - 1) * 18, w2, 4 + 18 * numOfLines), I18N.localise("botany.gui.database.tab.genome.varieties"), TextJustification.MIDDLE_RIGHT);
|
int tot = 0;
|
||||||
y += th;
|
for (IIndividual vid : BotanyCore.getFlowerRoot().getIndividualTemplates()) {
|
||||||
contents.setSize(new IPoint(contents.size().x(), y));
|
if (vid.getGenome().getPrimary() == treeSpecies) {
|
||||||
scrollable.setScrollableContent(contents);
|
if (tot > 0 && tot % 3 == 0) {
|
||||||
}
|
x -= 54;
|
||||||
|
y += 18;
|
||||||
|
}
|
||||||
|
ItemStack stack = BotanyCore.getFlowerRoot().getMemberStack(vid, EnumFlowerStage.FLOWER.ordinal());
|
||||||
|
ControlItemDisplay display = new ControlItemDisplay(contents, x, y);
|
||||||
|
display.setItemStack(stack);
|
||||||
|
tot++;
|
||||||
|
x += 18;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int numOfLines = 1 + (tot - 1) / 3;
|
||||||
|
new ControlText(
|
||||||
|
contents,
|
||||||
|
new IArea(0.0f, y - (numOfLines - 1) * 18, w2, 4 + 18 * numOfLines),
|
||||||
|
I18N.localise("botany.gui.database.tab.genome.varieties"),
|
||||||
|
TextJustification.MIDDLE_RIGHT);
|
||||||
|
y += th;
|
||||||
|
contents.setSize(new IPoint(contents.size().x(), y));
|
||||||
|
scrollable.setScrollableContent(contents);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
package binnie.botany.craftgui;
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import binnie.botany.api.IFlowerColor;
|
import binnie.botany.api.IFlowerColor;
|
||||||
@@ -21,71 +27,72 @@ import binnie.core.craftgui.geometry.IArea;
|
|||||||
import binnie.core.craftgui.minecraft.Window;
|
import binnie.core.craftgui.minecraft.Window;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
||||||
public WindowBotanistDatabase(EntityPlayer player, Side side, boolean nei) {
|
|
||||||
super(player, side, nei, Binnie.Genetics.flowerBreedingSystem, 130.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Window create(EntityPlayer player, Side side, boolean nei) {
|
public WindowBotanistDatabase(EntityPlayer player, Side side, boolean nei) {
|
||||||
return new WindowBotanistDatabase(player, side, nei);
|
super(player, side, nei, Binnie.Genetics.flowerBreedingSystem, 130.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public static Window create(EntityPlayer player, Side side, boolean nei) {
|
||||||
protected void addTabs() {
|
return new WindowBotanistDatabase(player, side, nei);
|
||||||
new PageSpeciesOverview(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.overview"));
|
}
|
||||||
new PageSpeciesFlowerGenome(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "genome"));
|
|
||||||
new PageSpeciesClassification(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.classification"));
|
|
||||||
new PageSpeciesResultant(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.resultant"));
|
|
||||||
new PageSpeciesMutations(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.further"));
|
|
||||||
new PageBranchOverview(getInfoPages(Mode.Branches), new DatabaseTab(Botany.instance, "branches.overview"));
|
|
||||||
new PageBranchSpecies(getInfoPages(Mode.Branches), new DatabaseTab(Botany.instance, "branches.species"));
|
|
||||||
createMode(FlowerMode.COLOR, new ColorModeWidget());
|
|
||||||
new PageColorMixResultant(getInfoPages(FlowerMode.COLOR), new DatabaseTab(Botany.instance, "colour.resultant"));
|
|
||||||
new PageColorMix(getInfoPages(FlowerMode.COLOR), new DatabaseTab(Botany.instance, "colour.further"));
|
|
||||||
new PageBreeder(getInfoPages(Mode.Breeder), getUsername(), new DatabaseTab(Botany.instance, "breeder"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AbstractMod getMod() {
|
protected void addTabs() {
|
||||||
return Botany.instance;
|
new PageSpeciesOverview(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.overview"));
|
||||||
}
|
new PageSpeciesFlowerGenome(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "genome"));
|
||||||
|
new PageSpeciesClassification(
|
||||||
|
getInfoPages(Mode.Species),
|
||||||
|
new DatabaseTab(Botany.instance, "species.classification"));
|
||||||
|
new PageSpeciesResultant(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.resultant"));
|
||||||
|
new PageSpeciesMutations(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.further"));
|
||||||
|
new PageBranchOverview(getInfoPages(Mode.Branches), new DatabaseTab(Botany.instance, "branches.overview"));
|
||||||
|
new PageBranchSpecies(getInfoPages(Mode.Branches), new DatabaseTab(Botany.instance, "branches.species"));
|
||||||
|
createMode(FlowerMode.COLOR, new ColorModeWidget());
|
||||||
|
new PageColorMixResultant(getInfoPages(FlowerMode.COLOR), new DatabaseTab(Botany.instance, "colour.resultant"));
|
||||||
|
new PageColorMix(getInfoPages(FlowerMode.COLOR), new DatabaseTab(Botany.instance, "colour.further"));
|
||||||
|
new PageBreeder(getInfoPages(Mode.Breeder), getUsername(), new DatabaseTab(Botany.instance, "breeder"));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getName() {
|
protected AbstractMod getMod() {
|
||||||
return I18N.localise("botany.gui.database.name");
|
return Botany.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum FlowerMode implements IDatabaseMode {
|
@Override
|
||||||
COLOR;
|
protected String getName() {
|
||||||
|
return I18N.localise("botany.gui.database.name");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
enum FlowerMode implements IDatabaseMode {
|
||||||
public String getName() {
|
|
||||||
return I18N.localise("botany.gui.database.tab." + name().toLowerCase());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class ColorModeWidget extends ModeWidgets {
|
COLOR;
|
||||||
public ColorModeWidget() {
|
|
||||||
super(FlowerMode.COLOR, WindowBotanistDatabase.this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createListBox(IArea area) {
|
public String getName() {
|
||||||
listBox = new ControlListBox<IFlowerColor>(modePage, area.x(), area.y(), area.w(), area.h(), 12.0f) {
|
return I18N.localise("botany.gui.database.tab." + name().toLowerCase());
|
||||||
@Override
|
}
|
||||||
public IWidget createOption(IFlowerColor value, int y) {
|
}
|
||||||
return new ControlColorOption(getContent(), value, y);
|
|
||||||
}
|
private class ColorModeWidget extends ModeWidgets {
|
||||||
};
|
|
||||||
List<IFlowerColor> colors = new ArrayList<>();
|
public ColorModeWidget() {
|
||||||
Collections.addAll(colors, EnumFlowerColor.values());
|
super(FlowerMode.COLOR, WindowBotanistDatabase.this);
|
||||||
listBox.setOptions(colors);
|
}
|
||||||
}
|
|
||||||
}
|
@Override
|
||||||
|
public void createListBox(IArea area) {
|
||||||
|
listBox = new ControlListBox<IFlowerColor>(modePage, area.x(), area.y(), area.w(), area.h(), 12.0f) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IWidget createOption(IFlowerColor value, int y) {
|
||||||
|
return new ControlColorOption(getContent(), value, y);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
List<IFlowerColor> colors = new ArrayList<>();
|
||||||
|
Collections.addAll(colors, EnumFlowerColor.values());
|
||||||
|
listBox.setOptions(colors);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
package binnie.botany.farm;
|
package binnie.botany.farm;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.EnumAcidity;
|
||||||
import binnie.botany.api.EnumMoisture;
|
import binnie.botany.api.EnumMoisture;
|
||||||
import binnie.core.circuits.BinnieCircuit;
|
import binnie.core.circuits.BinnieCircuit;
|
||||||
@@ -7,101 +10,99 @@ import binnie.core.util.I18N;
|
|||||||
import forestry.api.circuits.ChipsetManager;
|
import forestry.api.circuits.ChipsetManager;
|
||||||
import forestry.api.farming.FarmDirection;
|
import forestry.api.farming.FarmDirection;
|
||||||
import forestry.api.farming.IFarmHousing;
|
import forestry.api.farming.IFarmHousing;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
|
||||||
|
|
||||||
public class CircuitGarden extends BinnieCircuit {
|
public class CircuitGarden extends BinnieCircuit {
|
||||||
private boolean isManual;
|
|
||||||
private boolean isFertilised;
|
|
||||||
private ItemStack icon;
|
|
||||||
private EnumMoisture moisture;
|
|
||||||
private EnumAcidity acidity;
|
|
||||||
|
|
||||||
public CircuitGarden(EnumMoisture moisture, EnumAcidity ph, boolean manual, boolean fertilised, ItemStack recipe, ItemStack icon) {
|
private boolean isManual;
|
||||||
super("garden." + moisture.getID() + ((ph != null) ? ("." + ph.getID()) : "") + (manual ? ".manual" : "") + (fertilised ? ".fert" : ""), 4, manual ? ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual") : ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed"), recipe);
|
private boolean isFertilised;
|
||||||
this.moisture = moisture;
|
private ItemStack icon;
|
||||||
this.icon = icon;
|
private EnumMoisture moisture;
|
||||||
isManual = manual;
|
private EnumAcidity acidity;
|
||||||
isFertilised = fertilised;
|
|
||||||
acidity = ph;
|
|
||||||
String info = "";
|
|
||||||
|
|
||||||
if (moisture == EnumMoisture.DRY) {
|
public CircuitGarden(EnumMoisture moisture, EnumAcidity ph, boolean manual, boolean fertilised, ItemStack recipe,
|
||||||
info += EnumChatFormatting.YELLOW
|
ItemStack icon) {
|
||||||
+ I18N.localise("botany.moisture.dry")
|
super(
|
||||||
+ EnumChatFormatting.RESET;
|
"garden." + moisture.getID()
|
||||||
}
|
+ ((ph != null) ? ("." + ph.getID()) : "")
|
||||||
|
+ (manual ? ".manual" : "")
|
||||||
|
+ (fertilised ? ".fert" : ""),
|
||||||
|
4,
|
||||||
|
manual ? ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual")
|
||||||
|
: ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed"),
|
||||||
|
recipe);
|
||||||
|
this.moisture = moisture;
|
||||||
|
this.icon = icon;
|
||||||
|
isManual = manual;
|
||||||
|
isFertilised = fertilised;
|
||||||
|
acidity = ph;
|
||||||
|
String info = "";
|
||||||
|
|
||||||
if (moisture == EnumMoisture.DAMP) {
|
if (moisture == EnumMoisture.DRY) {
|
||||||
info += EnumChatFormatting.YELLOW
|
info += EnumChatFormatting.YELLOW + I18N.localise("botany.moisture.dry") + EnumChatFormatting.RESET;
|
||||||
+ I18N.localise("botany.moisture.damp")
|
}
|
||||||
+ EnumChatFormatting.RESET;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (acidity == EnumAcidity.ACID) {
|
if (moisture == EnumMoisture.DAMP) {
|
||||||
if (info.length() > 0) {
|
info += EnumChatFormatting.YELLOW + I18N.localise("botany.moisture.damp") + EnumChatFormatting.RESET;
|
||||||
info += ", ";
|
}
|
||||||
}
|
|
||||||
info += EnumChatFormatting.RED
|
|
||||||
+ I18N.localise("botany.ph.acid")
|
|
||||||
+ EnumChatFormatting.RESET;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (acidity == EnumAcidity.NEUTRAL) {
|
if (acidity == EnumAcidity.ACID) {
|
||||||
if (info.length() > 0) {
|
if (info.length() > 0) {
|
||||||
info += ", ";
|
info += ", ";
|
||||||
}
|
}
|
||||||
info += EnumChatFormatting.GREEN
|
info += EnumChatFormatting.RED + I18N.localise("botany.ph.acid") + EnumChatFormatting.RESET;
|
||||||
+ I18N.localise("botany.ph.neutral")
|
}
|
||||||
+ EnumChatFormatting.RESET;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (acidity == EnumAcidity.ALKALINE) {
|
if (acidity == EnumAcidity.NEUTRAL) {
|
||||||
if (info.length() > 0) {
|
if (info.length() > 0) {
|
||||||
info += ", ";
|
info += ", ";
|
||||||
}
|
}
|
||||||
info += EnumChatFormatting.AQUA
|
info += EnumChatFormatting.GREEN + I18N.localise("botany.ph.neutral") + EnumChatFormatting.RESET;
|
||||||
+ I18N.localise("botany.ph.alkaline")
|
}
|
||||||
+ EnumChatFormatting.RESET;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info.length() > 0) {
|
if (acidity == EnumAcidity.ALKALINE) {
|
||||||
info = " (" + info + EnumChatFormatting.RESET + ")";
|
if (info.length() > 0) {
|
||||||
}
|
info += ", ";
|
||||||
addTooltipString(I18N.localise("botany.circuit.flowers") + info);
|
}
|
||||||
}
|
info += EnumChatFormatting.AQUA + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
if (info.length() > 0) {
|
||||||
public boolean isCircuitable(Object tile) {
|
info = " (" + info + EnumChatFormatting.RESET + ")";
|
||||||
return tile instanceof IFarmHousing;
|
}
|
||||||
}
|
addTooltipString(I18N.localise("botany.circuit.flowers") + info);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInsertion(int slot, Object tile) {
|
public boolean isCircuitable(Object tile) {
|
||||||
if (!isCircuitable(tile)) {
|
return tile instanceof IFarmHousing;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
GardenLogic logic = new GardenLogic((IFarmHousing) tile);
|
@Override
|
||||||
logic.setData(moisture, acidity, isManual, isFertilised, icon, I18N.localise(getName()));
|
public void onInsertion(int slot, Object tile) {
|
||||||
((IFarmHousing) tile).setFarmLogic(FarmDirection.values()[slot], logic);
|
if (!isCircuitable(tile)) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
GardenLogic logic = new GardenLogic((IFarmHousing) tile);
|
||||||
public void onLoad(int slot, Object tile) {
|
logic.setData(moisture, acidity, isManual, isFertilised, icon, I18N.localise(getName()));
|
||||||
onInsertion(slot, tile);
|
((IFarmHousing) tile).setFarmLogic(FarmDirection.values()[slot], logic);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRemoval(int slot, Object tile) {
|
public void onLoad(int slot, Object tile) {
|
||||||
if (!isCircuitable(tile)) {
|
onInsertion(slot, tile);
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
((IFarmHousing) tile).resetFarmLogic(FarmDirection.values()[slot]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTick(int arg0, Object arg1) {
|
public void onRemoval(int slot, Object tile) {
|
||||||
// ignored
|
if (!isCircuitable(tile)) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
((IFarmHousing) tile).resetFarmLogic(FarmDirection.values()[slot]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTick(int arg0, Object arg1) {
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,58 +1,59 @@
|
|||||||
package binnie.botany.farm;
|
package binnie.botany.farm;
|
||||||
|
|
||||||
import forestry.api.farming.FarmDirection;
|
|
||||||
import forestry.api.farming.IFarmHousing;
|
|
||||||
import forestry.api.farming.IFarmLogic;
|
|
||||||
import forestry.core.utils.vect.Vect;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import forestry.api.farming.FarmDirection;
|
||||||
|
import forestry.api.farming.IFarmHousing;
|
||||||
|
import forestry.api.farming.IFarmLogic;
|
||||||
|
import forestry.core.utils.vect.Vect;
|
||||||
|
|
||||||
public abstract class FarmLogic implements IFarmLogic {
|
public abstract class FarmLogic implements IFarmLogic {
|
||||||
protected World world;
|
|
||||||
protected IFarmHousing housing;
|
|
||||||
protected boolean isManual;
|
|
||||||
|
|
||||||
public FarmLogic(IFarmHousing housing) {
|
protected World world;
|
||||||
this.housing = housing;
|
protected IFarmHousing housing;
|
||||||
}
|
protected boolean isManual;
|
||||||
|
|
||||||
@Override
|
public FarmLogic(IFarmHousing housing) {
|
||||||
public IFarmLogic setManual(boolean flag) {
|
this.housing = housing;
|
||||||
isManual = flag;
|
}
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isAirBlock(Vect position) {
|
@Override
|
||||||
return world.isAirBlock(position.x, position.y, position.z);
|
public IFarmLogic setManual(boolean flag) {
|
||||||
}
|
isManual = flag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean isWaterBlock(Vect position) {
|
protected boolean isAirBlock(Vect position) {
|
||||||
return world.getBlock(position.x, position.y, position.z) == Blocks.water;
|
return world.isAirBlock(position.x, position.y, position.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Block getBlock(Vect position) {
|
protected boolean isWaterBlock(Vect position) {
|
||||||
return world.getBlock(position.x, position.y, position.z);
|
return world.getBlock(position.x, position.y, position.z) == Blocks.water;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getBlockMeta(Vect position) {
|
protected Block getBlock(Vect position) {
|
||||||
return world.getBlockMetadata(position.x, position.y, position.z);
|
return world.getBlock(position.x, position.y, position.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemStack getAsItemStack(Vect position) {
|
protected int getBlockMeta(Vect position) {
|
||||||
return new ItemStack(getBlock(position), 1, getBlockMeta(position));
|
return world.getBlockMetadata(position.x, position.y, position.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Vect translateWithOffset(int x, int y, int z, FarmDirection direction, int step) {
|
protected ItemStack getAsItemStack(Vect position) {
|
||||||
return new Vect(
|
return new ItemStack(getBlock(position), 1, getBlockMeta(position));
|
||||||
x + direction.getForgeDirection().offsetX * step,
|
}
|
||||||
y + direction.getForgeDirection().offsetY * step,
|
|
||||||
z + direction.getForgeDirection().offsetZ * step
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setBlock(Vect position, Block block, int meta) {
|
protected Vect translateWithOffset(int x, int y, int z, FarmDirection direction, int step) {
|
||||||
world.setBlock(position.x, position.y, position.z, block, meta, 2);
|
return new Vect(
|
||||||
}
|
x + direction.getForgeDirection().offsetX * step,
|
||||||
|
y + direction.getForgeDirection().offsetY * step,
|
||||||
|
z + direction.getForgeDirection().offsetZ * step);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setBlock(Vect position, Block block, int meta) {
|
||||||
|
world.setBlock(position.x, position.y, position.z, block, meta, 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
package binnie.botany.farm;
|
package binnie.botany.farm;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
import binnie.botany.api.IFlower;
|
import binnie.botany.api.IFlower;
|
||||||
@@ -7,36 +11,34 @@ import binnie.botany.core.BotanyCore;
|
|||||||
import binnie.botany.gardening.Gardening;
|
import binnie.botany.gardening.Gardening;
|
||||||
import forestry.api.farming.ICrop;
|
import forestry.api.farming.ICrop;
|
||||||
import forestry.api.farming.IFarmable;
|
import forestry.api.farming.IFarmable;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class FarmableFlower implements IFarmable {
|
public class FarmableFlower implements IFarmable {
|
||||||
@Override
|
|
||||||
public boolean isSaplingAt(World world, int x, int y, int z) {
|
|
||||||
return world.getBlock(x, y, z) == Botany.flower;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICrop getCropAt(World world, int x, int y, int z) {
|
public boolean isSaplingAt(World world, int x, int y, int z) {
|
||||||
return null;
|
return world.getBlock(x, y, z) == Botany.flower;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isGermling(ItemStack itemstack) {
|
public ICrop getCropAt(World world, int x, int y, int z) {
|
||||||
EnumFlowerStage stage = BotanyCore.speciesRoot.getStageType(itemstack);
|
return null;
|
||||||
return stage == EnumFlowerStage.FLOWER || stage == EnumFlowerStage.SEED;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWindfall(ItemStack itemstack) {
|
public boolean isGermling(ItemStack itemstack) {
|
||||||
return false;
|
EnumFlowerStage stage = BotanyCore.speciesRoot.getStageType(itemstack);
|
||||||
}
|
return stage == EnumFlowerStage.FLOWER || stage == EnumFlowerStage.SEED;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, int x, int y, int z) {
|
public boolean isWindfall(ItemStack itemstack) {
|
||||||
IFlower flower = BotanyCore.getFlowerRoot().getMember(germling);
|
return false;
|
||||||
Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
}
|
||||||
return true;
|
|
||||||
}
|
@Override
|
||||||
|
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, int x, int y, int z) {
|
||||||
|
IFlower flower = BotanyCore.getFlowerRoot().getMember(germling);
|
||||||
|
Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,21 +1,23 @@
|
|||||||
package binnie.botany.farm;
|
package binnie.botany.farm;
|
||||||
|
|
||||||
import binnie.botany.api.IFlower;
|
|
||||||
import binnie.botany.core.BotanyCore;
|
|
||||||
import binnie.botany.gardening.Gardening;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class FarmableVanillaFlower extends FarmableFlower {
|
import binnie.botany.api.IFlower;
|
||||||
@Override
|
import binnie.botany.core.BotanyCore;
|
||||||
public boolean isGermling(ItemStack itemstack) {
|
import binnie.botany.gardening.Gardening;
|
||||||
return BotanyCore.getFlowerRoot().getConversion(itemstack) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public class FarmableVanillaFlower extends FarmableFlower {
|
||||||
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, int x, int y, int z) {
|
|
||||||
IFlower flower = BotanyCore.getFlowerRoot().getConversion(germling);
|
@Override
|
||||||
return Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
public boolean isGermling(ItemStack itemstack) {
|
||||||
}
|
return BotanyCore.getFlowerRoot().getConversion(itemstack) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, int x, int y, int z) {
|
||||||
|
IFlower flower = BotanyCore.getFlowerRoot().getConversion(germling);
|
||||||
|
return Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,22 +1,9 @@
|
|||||||
package binnie.botany.farm;
|
package binnie.botany.farm;
|
||||||
|
|
||||||
import binnie.Binnie;
|
import java.util.ArrayList;
|
||||||
import binnie.botany.Botany;
|
import java.util.Collection;
|
||||||
import binnie.botany.api.EnumAcidity;
|
import java.util.List;
|
||||||
import binnie.botany.api.EnumMoisture;
|
|
||||||
import binnie.botany.api.EnumSoilType;
|
|
||||||
import binnie.botany.api.gardening.IBlockSoil;
|
|
||||||
import binnie.botany.flower.TileEntityFlower;
|
|
||||||
import binnie.botany.gardening.Gardening;
|
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import forestry.api.farming.FarmDirection;
|
|
||||||
import forestry.api.farming.ICrop;
|
|
||||||
import forestry.api.farming.IFarmHousing;
|
|
||||||
import forestry.api.farming.IFarmable;
|
|
||||||
import forestry.core.access.IOwnable;
|
|
||||||
import forestry.core.utils.vect.Vect;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
@@ -28,380 +15,388 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.mojang.authlib.GameProfile;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import binnie.Binnie;
|
||||||
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.api.EnumAcidity;
|
||||||
|
import binnie.botany.api.EnumMoisture;
|
||||||
|
import binnie.botany.api.EnumSoilType;
|
||||||
|
import binnie.botany.api.gardening.IBlockSoil;
|
||||||
|
import binnie.botany.flower.TileEntityFlower;
|
||||||
|
import binnie.botany.gardening.Gardening;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import forestry.api.farming.FarmDirection;
|
||||||
|
import forestry.api.farming.ICrop;
|
||||||
|
import forestry.api.farming.IFarmHousing;
|
||||||
|
import forestry.api.farming.IFarmable;
|
||||||
|
import forestry.core.access.IOwnable;
|
||||||
|
import forestry.core.utils.vect.Vect;
|
||||||
|
|
||||||
public class GardenLogic extends FarmLogic {
|
public class GardenLogic extends FarmLogic {
|
||||||
protected EnumMoisture moisture;
|
|
||||||
protected EnumAcidity acidity;
|
|
||||||
protected boolean fertilised;
|
|
||||||
protected String name;
|
|
||||||
protected ArrayList<ItemStack> produce;
|
|
||||||
protected List<IFarmable> farmables;
|
|
||||||
|
|
||||||
private ItemStack icon;
|
protected EnumMoisture moisture;
|
||||||
|
protected EnumAcidity acidity;
|
||||||
|
protected boolean fertilised;
|
||||||
|
protected String name;
|
||||||
|
protected ArrayList<ItemStack> produce;
|
||||||
|
protected List<IFarmable> farmables;
|
||||||
|
|
||||||
public GardenLogic(IFarmHousing housing) {
|
private ItemStack icon;
|
||||||
super(housing);
|
|
||||||
produce = new ArrayList<>();
|
|
||||||
farmables = new ArrayList<>();
|
|
||||||
farmables.add(new FarmableFlower());
|
|
||||||
farmables.add(new FarmableVanillaFlower());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public GardenLogic(IFarmHousing housing) {
|
||||||
public int getFertilizerConsumption() {
|
super(housing);
|
||||||
return fertilised ? 8 : 2;
|
produce = new ArrayList<>();
|
||||||
}
|
farmables = new ArrayList<>();
|
||||||
|
farmables.add(new FarmableFlower());
|
||||||
|
farmables.add(new FarmableVanillaFlower());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getWaterConsumption(float hydrationModifier) {
|
public int getFertilizerConsumption() {
|
||||||
return (int) (moisture.ordinal() * 40 * hydrationModifier);
|
return fertilised ? 8 : 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAcceptedResource(ItemStack stack) {
|
public int getWaterConsumption(float hydrationModifier) {
|
||||||
Item item = stack.getItem();
|
return (int) (moisture.ordinal() * 40 * hydrationModifier);
|
||||||
return Gardening.isSoil(item)
|
}
|
||||||
|| item == Item.getItemFromBlock(Blocks.sand)
|
|
||||||
|| item == Item.getItemFromBlock(Blocks.dirt)
|
|
||||||
|| Gardening.isAcidFertiliser(stack)
|
|
||||||
|| Gardening.isAlkalineFertiliser(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<ItemStack> collect() {
|
public boolean isAcceptedResource(ItemStack stack) {
|
||||||
Collection<ItemStack> products = produce;
|
Item item = stack.getItem();
|
||||||
produce = new ArrayList<>();
|
return Gardening.isSoil(item) || item == Item.getItemFromBlock(Blocks.sand)
|
||||||
return products;
|
|| item == Item.getItemFromBlock(Blocks.dirt)
|
||||||
}
|
|| Gardening.isAcidFertiliser(stack)
|
||||||
|
|| Gardening.isAlkalineFertiliser(stack);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean cultivate(int x, int y, int z, FarmDirection direction, int extent) {
|
public Collection<ItemStack> collect() {
|
||||||
world = housing.getWorld();
|
Collection<ItemStack> products = produce;
|
||||||
return maintainSoil(x, y, z, direction, extent)
|
produce = new ArrayList<>();
|
||||||
|| !isManual && maintainWater(x, y, z, direction, extent)
|
return products;
|
||||||
|| maintainCrops(x, y + 1, z, direction, extent);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isWaste(ItemStack stack) {
|
@Override
|
||||||
return stack.getItem() == Item.getItemFromBlock(Blocks.dirt);
|
public boolean cultivate(int x, int y, int z, FarmDirection direction, int extent) {
|
||||||
}
|
world = housing.getWorld();
|
||||||
|
return maintainSoil(x, y, z, direction, extent) || !isManual && maintainWater(x, y, z, direction, extent)
|
||||||
|
|| maintainCrops(x, y + 1, z, direction, extent);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean maintainSoil(int x, int y, int z, FarmDirection direction, int extent) {
|
private boolean isWaste(ItemStack stack) {
|
||||||
for (int i = 0; i < extent; ++i) {
|
return stack.getItem() == Item.getItemFromBlock(Blocks.dirt);
|
||||||
Vect position = translateWithOffset(x, y, z, direction, i);
|
}
|
||||||
boolean isSoil = Gardening.isSoil(world.getBlock(position.x, position.y, position.z));
|
|
||||||
|
|
||||||
// remove unnecessary blocks
|
|
||||||
if (!isManual && !isSoil && !isAirBlock(position)) {
|
|
||||||
Block block = world.getBlock(position.x, position.y, position.z);
|
|
||||||
if (moisture == EnumMoisture.DAMP) {
|
|
||||||
if (block != Blocks.water) {
|
|
||||||
dropBlockAsProduction(position);
|
|
||||||
}
|
|
||||||
} else if (moisture == EnumMoisture.DRY) {
|
|
||||||
if (block != Blocks.sand) {
|
|
||||||
dropBlockAsProduction(position);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dropBlockAsProduction(position);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fertilised && isSoil) {
|
private boolean maintainSoil(int x, int y, int z, FarmDirection direction, int extent) {
|
||||||
IBlockSoil soil = (IBlockSoil) world.getBlock(position.x, position.y, position.z);
|
for (int i = 0; i < extent; ++i) {
|
||||||
if (soil.fertilise(world, position.x, position.y, position.z, EnumSoilType.FLOWERBED)) {
|
Vect position = translateWithOffset(x, y, z, direction, i);
|
||||||
continue;
|
boolean isSoil = Gardening.isSoil(world.getBlock(position.x, position.y, position.z));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (world.getBlock(position.x, position.y + 1, position.z) == Botany.plant) {
|
// remove unnecessary blocks
|
||||||
world.setBlockToAir(position.x, position.y + 1, position.z);
|
if (!isManual && !isSoil && !isAirBlock(position)) {
|
||||||
continue;
|
Block block = world.getBlock(position.x, position.y, position.z);
|
||||||
}
|
if (moisture == EnumMoisture.DAMP) {
|
||||||
|
if (block != Blocks.water) {
|
||||||
|
dropBlockAsProduction(position);
|
||||||
|
}
|
||||||
|
} else if (moisture == EnumMoisture.DRY) {
|
||||||
|
if (block != Blocks.sand) {
|
||||||
|
dropBlockAsProduction(position);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dropBlockAsProduction(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (acidity != null && isSoil) {
|
if (fertilised && isSoil) {
|
||||||
IBlockSoil soil = (IBlockSoil) world.getBlock(position.x, position.y, position.z);
|
IBlockSoil soil = (IBlockSoil) world.getBlock(position.x, position.y, position.z);
|
||||||
EnumAcidity pH = soil.getPH(world, position.x, position.y, position.z);
|
if (soil.fertilise(world, position.x, position.y, position.z, EnumSoilType.FLOWERBED)) {
|
||||||
if (pH.ordinal() < acidity.ordinal()) {
|
continue;
|
||||||
ItemStack stack = getAvailableAlkaline();
|
}
|
||||||
if (stack != null && soil.setPH(world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() + 1])) {
|
}
|
||||||
housing.getFarmInventory().removeResources(new ItemStack[]{stack});
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pH.ordinal() > acidity.ordinal()) {
|
if (world.getBlock(position.x, position.y + 1, position.z) == Botany.plant) {
|
||||||
ItemStack stack = getAvailableAcid();
|
world.setBlockToAir(position.x, position.y + 1, position.z);
|
||||||
if (stack != null && soil.setPH(world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() - 1])) {
|
continue;
|
||||||
housing.getFarmInventory().removeResources(new ItemStack[]{stack});
|
}
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isAirBlock(position) && !world.getBlock(position.x, position.y, position.z).isReplaceable(world, position.x, position.y, position.z)) {
|
if (acidity != null && isSoil) {
|
||||||
ItemStack block = getAsItemStack(position);
|
IBlockSoil soil = (IBlockSoil) world.getBlock(position.x, position.y, position.z);
|
||||||
ItemStack loam = getAvailableLoam();
|
EnumAcidity pH = soil.getPH(world, position.x, position.y, position.z);
|
||||||
if (isWaste(block) && loam != null) {
|
if (pH.ordinal() < acidity.ordinal()) {
|
||||||
produce.addAll(Blocks.dirt.getDrops(world, position.x, position.y, position.z, block.getItemDamage(), 0));
|
ItemStack stack = getAvailableAlkaline();
|
||||||
setBlock(position, Blocks.air, 0);
|
if (stack != null && soil
|
||||||
return trySetSoil(position, loam);
|
.setPH(world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() + 1])) {
|
||||||
}
|
housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
||||||
} else if (!isManual) {
|
continue;
|
||||||
if (!isWaterBlock(position)) {
|
}
|
||||||
if (i % 2 == 0) {
|
}
|
||||||
return trySetSoil(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
FarmDirection cclock = FarmDirection.EAST;
|
if (pH.ordinal() > acidity.ordinal()) {
|
||||||
if (direction == FarmDirection.EAST) {
|
ItemStack stack = getAvailableAcid();
|
||||||
cclock = FarmDirection.SOUTH;
|
if (stack != null && soil
|
||||||
} else if (direction == FarmDirection.SOUTH) {
|
.setPH(world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() - 1])) {
|
||||||
cclock = FarmDirection.EAST;
|
housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
||||||
} else if (direction == FarmDirection.WEST) {
|
continue;
|
||||||
cclock = FarmDirection.SOUTH;
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Vect previous = translateWithOffset(position.x, position.y, position.z, cclock, 1);
|
if (!isAirBlock(position) && !world.getBlock(position.x, position.y, position.z)
|
||||||
ItemStack soil2 = getAsItemStack(previous);
|
.isReplaceable(world, position.x, position.y, position.z)) {
|
||||||
if (!Gardening.isSoil(soil2.getItem())) {
|
ItemStack block = getAsItemStack(position);
|
||||||
trySetSoil(position);
|
ItemStack loam = getAvailableLoam();
|
||||||
}
|
if (isWaste(block) && loam != null) {
|
||||||
}
|
produce.addAll(
|
||||||
}
|
Blocks.dirt.getDrops(world, position.x, position.y, position.z, block.getItemDamage(), 0));
|
||||||
}
|
setBlock(position, Blocks.air, 0);
|
||||||
return false;
|
return trySetSoil(position, loam);
|
||||||
}
|
}
|
||||||
|
} else if (!isManual) {
|
||||||
|
if (!isWaterBlock(position)) {
|
||||||
|
if (i % 2 == 0) {
|
||||||
|
return trySetSoil(position);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean maintainWater(int x, int y, int z, FarmDirection direction, int extent) {
|
FarmDirection cclock = FarmDirection.EAST;
|
||||||
for (int i = 0; i < extent; ++i) {
|
if (direction == FarmDirection.EAST) {
|
||||||
Vect position = translateWithOffset(x, y, z, direction, i);
|
cclock = FarmDirection.SOUTH;
|
||||||
if (!isAirBlock(position) && !world.getBlock(x, y, z).isReplaceable(world, position.x, position.y, position.z)) {
|
} else if (direction == FarmDirection.SOUTH) {
|
||||||
continue;
|
cclock = FarmDirection.EAST;
|
||||||
}
|
} else if (direction == FarmDirection.WEST) {
|
||||||
|
cclock = FarmDirection.SOUTH;
|
||||||
|
}
|
||||||
|
|
||||||
if (isWaterBlock(position)) {
|
Vect previous = translateWithOffset(position.x, position.y, position.z, cclock, 1);
|
||||||
continue;
|
ItemStack soil2 = getAsItemStack(previous);
|
||||||
}
|
if (!Gardening.isSoil(soil2.getItem())) {
|
||||||
|
trySetSoil(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
boolean isEnclosed = true;
|
private boolean maintainWater(int x, int y, int z, FarmDirection direction, int extent) {
|
||||||
if (world.isAirBlock(position.x + 1, position.y, position.z)) {
|
for (int i = 0; i < extent; ++i) {
|
||||||
isEnclosed = false;
|
Vect position = translateWithOffset(x, y, z, direction, i);
|
||||||
} else if (world.isAirBlock(position.x - 1, position.y, position.z)) {
|
if (!isAirBlock(position)
|
||||||
isEnclosed = false;
|
&& !world.getBlock(x, y, z).isReplaceable(world, position.x, position.y, position.z)) {
|
||||||
} else if (world.isAirBlock(position.x, position.y, position.z + 1)) {
|
continue;
|
||||||
isEnclosed = false;
|
}
|
||||||
} else if (world.isAirBlock(position.x, position.y, position.z - 1)) {
|
|
||||||
isEnclosed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
isEnclosed = (isEnclosed || moisture != EnumMoisture.DAMP);
|
if (isWaterBlock(position)) {
|
||||||
if (isEnclosed) {
|
continue;
|
||||||
return trySetWater(position);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ItemStack getAvailableLoam() {
|
boolean isEnclosed = true;
|
||||||
EnumMoisture[] moistures;
|
if (world.isAirBlock(position.x + 1, position.y, position.z)) {
|
||||||
if (moisture == EnumMoisture.DAMP) {
|
isEnclosed = false;
|
||||||
moistures = new EnumMoisture[]{
|
} else if (world.isAirBlock(position.x - 1, position.y, position.z)) {
|
||||||
EnumMoisture.DAMP,
|
isEnclosed = false;
|
||||||
EnumMoisture.NORMAL,
|
} else if (world.isAirBlock(position.x, position.y, position.z + 1)) {
|
||||||
EnumMoisture.DRY
|
isEnclosed = false;
|
||||||
};
|
} else if (world.isAirBlock(position.x, position.y, position.z - 1)) {
|
||||||
} else if (moisture == EnumMoisture.DRY) {
|
isEnclosed = false;
|
||||||
moistures = new EnumMoisture[]{
|
}
|
||||||
EnumMoisture.DRY,
|
|
||||||
EnumMoisture.DAMP,
|
|
||||||
EnumMoisture.DRY
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
moistures = new EnumMoisture[]{
|
|
||||||
EnumMoisture.DRY,
|
|
||||||
EnumMoisture.NORMAL,
|
|
||||||
EnumMoisture.DAMP
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
EnumAcidity[] acidities = {
|
isEnclosed = (isEnclosed || moisture != EnumMoisture.DAMP);
|
||||||
EnumAcidity.NEUTRAL,
|
if (isEnclosed) {
|
||||||
EnumAcidity.ACID,
|
return trySetWater(position);
|
||||||
EnumAcidity.ALKALINE
|
}
|
||||||
};
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (EnumMoisture moist : moistures) {
|
private ItemStack getAvailableLoam() {
|
||||||
for (EnumAcidity acid : acidities) {
|
EnumMoisture[] moistures;
|
||||||
for (Block type : new Block[]{Botany.flowerbed, Botany.loam, Botany.soil}) {
|
if (moisture == EnumMoisture.DAMP) {
|
||||||
int meta = acid.ordinal() * 3 + moist.ordinal();
|
moistures = new EnumMoisture[] { EnumMoisture.DAMP, EnumMoisture.NORMAL, EnumMoisture.DRY };
|
||||||
ItemStack[] resource = {new ItemStack(type, 1, meta)};
|
} else if (moisture == EnumMoisture.DRY) {
|
||||||
if (housing.getFarmInventory().hasResources(resource)) {
|
moistures = new EnumMoisture[] { EnumMoisture.DRY, EnumMoisture.DAMP, EnumMoisture.DRY };
|
||||||
return resource[0];
|
} else {
|
||||||
}
|
moistures = new EnumMoisture[] { EnumMoisture.DRY, EnumMoisture.NORMAL, EnumMoisture.DAMP };
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (housing.getFarmInventory().hasResources(new ItemStack[]{new ItemStack(Blocks.dirt)})) {
|
EnumAcidity[] acidities = { EnumAcidity.NEUTRAL, EnumAcidity.ACID, EnumAcidity.ALKALINE };
|
||||||
return new ItemStack(Blocks.dirt);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean trySetSoil(Vect position) {
|
for (EnumMoisture moist : moistures) {
|
||||||
return trySetSoil(position, getAvailableLoam());
|
for (EnumAcidity acid : acidities) {
|
||||||
}
|
for (Block type : new Block[] { Botany.flowerbed, Botany.loam, Botany.soil }) {
|
||||||
|
int meta = acid.ordinal() * 3 + moist.ordinal();
|
||||||
|
ItemStack[] resource = { new ItemStack(type, 1, meta) };
|
||||||
|
if (housing.getFarmInventory().hasResources(resource)) {
|
||||||
|
return resource[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean trySetSoil(Vect position, ItemStack loam) {
|
if (housing.getFarmInventory().hasResources(new ItemStack[] { new ItemStack(Blocks.dirt) })) {
|
||||||
ItemStack copy = loam;
|
return new ItemStack(Blocks.dirt);
|
||||||
if (loam == null) {
|
}
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loam.getItem() == Item.getItemFromBlock(Blocks.dirt)) {
|
private boolean trySetSoil(Vect position) {
|
||||||
loam = new ItemStack(Botany.soil, 0, 4);
|
return trySetSoil(position, getAvailableLoam());
|
||||||
}
|
}
|
||||||
|
|
||||||
setBlock(position, ((ItemBlock) loam.getItem()).field_150939_a, loam.getItemDamage());
|
private boolean trySetSoil(Vect position, ItemStack loam) {
|
||||||
housing.getFarmInventory().removeResources(new ItemStack[]{copy});
|
ItemStack copy = loam;
|
||||||
return true;
|
if (loam == null) {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean trySetWater(Vect position) {
|
if (loam.getItem() == Item.getItemFromBlock(Blocks.dirt)) {
|
||||||
FluidStack water = Binnie.Liquid.getLiquidStack("water", 1000);
|
loam = new ItemStack(Botany.soil, 0, 4);
|
||||||
if (moisture == EnumMoisture.DAMP) {
|
}
|
||||||
if (!housing.hasLiquid(water)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
setBlock(position, Blocks.water, 0);
|
setBlock(position, ((ItemBlock) loam.getItem()).field_150939_a, loam.getItemDamage());
|
||||||
housing.removeLiquid(water);
|
housing.getFarmInventory().removeResources(new ItemStack[] { copy });
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moisture != EnumMoisture.DRY) {
|
private boolean trySetWater(Vect position) {
|
||||||
return trySetSoil(position);
|
FluidStack water = Binnie.Liquid.getLiquidStack("water", 1000);
|
||||||
}
|
if (moisture == EnumMoisture.DAMP) {
|
||||||
|
if (!housing.hasLiquid(water)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ItemStack[] sand = {new ItemStack(Blocks.sand, 1)};
|
setBlock(position, Blocks.water, 0);
|
||||||
if (!housing.getFarmInventory().hasResources(sand)) {
|
housing.removeLiquid(water);
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
setBlock(position, Blocks.sand, 0);
|
if (moisture != EnumMoisture.DRY) {
|
||||||
housing.getFarmInventory().removeResources(sand);
|
return trySetSoil(position);
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void dropBlockAsProduction(Vect position) {
|
ItemStack[] sand = { new ItemStack(Blocks.sand, 1) };
|
||||||
ItemStack stack = new ItemStack(world.getBlock(position.x, position.y, position.z));
|
if (!housing.getFarmInventory().hasResources(sand)) {
|
||||||
if (stack.getItem() == null) {
|
return false;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
produce.add(stack);
|
|
||||||
world.setBlockToAir(position.x, position.y, position.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
setBlock(position, Blocks.sand, 0);
|
||||||
public boolean isAcceptedGermling(ItemStack stack) {
|
housing.getFarmInventory().removeResources(sand);
|
||||||
for (IFarmable farmable : farmables) {
|
return true;
|
||||||
if (farmable.isGermling(stack)) {
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
private void dropBlockAsProduction(Vect position) {
|
||||||
public Collection<ICrop> harvest(int x, int y, int z, FarmDirection direction, int extent) {
|
ItemStack stack = new ItemStack(world.getBlock(position.x, position.y, position.z));
|
||||||
return null;
|
if (stack.getItem() == null) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
produce.add(stack);
|
||||||
|
world.setBlockToAir(position.x, position.y, position.z);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public boolean isAcceptedGermling(ItemStack stack) {
|
||||||
public IIcon getIcon() {
|
for (IFarmable farmable : farmables) {
|
||||||
return icon.getIconIndex();
|
if (farmable.isGermling(stack)) {
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public void setIcon(ItemStack icon) {
|
@Override
|
||||||
this.icon = icon;
|
public Collection<ICrop> harvest(int x, int y, int z, FarmDirection direction, int extent) {
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getSpriteSheet() {
|
@SideOnly(Side.CLIENT)
|
||||||
return TextureMap.locationBlocksTexture;
|
public IIcon getIcon() {
|
||||||
}
|
return icon.getIconIndex();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
public void setIcon(ItemStack icon) {
|
||||||
public String getName() {
|
this.icon = icon;
|
||||||
return name;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean maintainCrops(int x, int y, int z, FarmDirection direction, int extent) {
|
@Override
|
||||||
for (int i = 0; i < extent; ++i) {
|
public ResourceLocation getSpriteSheet() {
|
||||||
Vect position = translateWithOffset(x, y, z, direction, i);
|
return TextureMap.locationBlocksTexture;
|
||||||
if (isAirBlock(position) || world.getBlock(x, y, z).isReplaceable(world, position.x, position.y, position.z)) {
|
}
|
||||||
ItemStack below = getAsItemStack(position.add(new Vect(0, -1, 0)));
|
|
||||||
if (Gardening.isSoil(below.getItem())) {
|
|
||||||
return trySetCrop(position);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean trySetCrop(Vect position) {
|
@Override
|
||||||
for (IFarmable farmable : farmables) {
|
public String getName() {
|
||||||
boolean success = housing.plantGermling(farmable, world, position.x, position.y, position.z);
|
return name;
|
||||||
if (!success || !(housing instanceof IOwnable)) {
|
}
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
TileEntity tile = housing.getWorld().getTileEntity(position.x, position.y, position.z);
|
protected boolean maintainCrops(int x, int y, int z, FarmDirection direction, int extent) {
|
||||||
if (!(tile instanceof TileEntityFlower)) {
|
for (int i = 0; i < extent; ++i) {
|
||||||
return true;
|
Vect position = translateWithOffset(x, y, z, direction, i);
|
||||||
}
|
if (isAirBlock(position)
|
||||||
|
|| world.getBlock(x, y, z).isReplaceable(world, position.x, position.y, position.z)) {
|
||||||
|
ItemStack below = getAsItemStack(position.add(new Vect(0, -1, 0)));
|
||||||
|
if (Gardening.isSoil(below.getItem())) {
|
||||||
|
return trySetCrop(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
private boolean trySetCrop(Vect position) {
|
||||||
IOwnable housing2 = (IOwnable) housing;
|
for (IFarmable farmable : farmables) {
|
||||||
GameProfile prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile", new Class[0]).invoke(housing2);
|
boolean success = housing.plantGermling(farmable, world, position.x, position.y, position.z);
|
||||||
((TileEntityFlower) tile).setOwner(prof);
|
if (!success || !(housing instanceof IOwnable)) {
|
||||||
} catch (Exception ex) {
|
continue;
|
||||||
// ignored
|
}
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getAvailableAcid() {
|
TileEntity tile = housing.getWorld().getTileEntity(position.x, position.y, position.z);
|
||||||
for (ItemStack stack : Gardening.getAcidFertilisers()) {
|
if (!(tile instanceof TileEntityFlower)) {
|
||||||
if (stack != null && stack.getItem() != null && housing.getFarmInventory().hasResources(new ItemStack[]{stack})) {
|
return true;
|
||||||
return stack;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getAvailableAlkaline() {
|
try {
|
||||||
for (ItemStack stack : Gardening.getAlkalineFertilisers()) {
|
IOwnable housing2 = (IOwnable) housing;
|
||||||
if (stack != null && stack.getItem() != null && housing.getFarmInventory().hasResources(new ItemStack[]{stack})) {
|
GameProfile prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile", new Class[0])
|
||||||
return stack;
|
.invoke(housing2);
|
||||||
}
|
((TileEntityFlower) tile).setOwner(prof);
|
||||||
}
|
} catch (Exception ex) {
|
||||||
return null;
|
// ignored
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public void setData(EnumMoisture moisture, EnumAcidity acidity, boolean isManual, boolean fertilised, ItemStack icon, String name) {
|
public ItemStack getAvailableAcid() {
|
||||||
this.moisture = moisture;
|
for (ItemStack stack : Gardening.getAcidFertilisers()) {
|
||||||
this.acidity = acidity;
|
if (stack != null && stack.getItem() != null
|
||||||
this.isManual = isManual;
|
&& housing.getFarmInventory().hasResources(new ItemStack[] { stack })) {
|
||||||
this.fertilised = fertilised;
|
return stack;
|
||||||
this.icon = icon;
|
}
|
||||||
this.name = name;
|
}
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getAvailableAlkaline() {
|
||||||
|
for (ItemStack stack : Gardening.getAlkalineFertilisers()) {
|
||||||
|
if (stack != null && stack.getItem() != null
|
||||||
|
&& housing.getFarmInventory().hasResources(new ItemStack[] { stack })) {
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(EnumMoisture moisture, EnumAcidity acidity, boolean isManual, boolean fertilised,
|
||||||
|
ItemStack icon, String name) {
|
||||||
|
this.moisture = moisture;
|
||||||
|
this.acidity = acidity;
|
||||||
|
this.isManual = isManual;
|
||||||
|
this.fertilised = fertilised;
|
||||||
|
this.icon = icon;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,9 @@
|
|||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import java.util.ArrayList;
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
import java.util.List;
|
||||||
import binnie.botany.api.IFlower;
|
import java.util.Random;
|
||||||
import binnie.botany.api.IFlowerType;
|
|
||||||
import binnie.botany.core.BotanyCore;
|
|
||||||
import binnie.botany.gardening.Gardening;
|
|
||||||
import binnie.botany.genetics.EnumFlowerType;
|
|
||||||
import binnie.core.BinnieCore;
|
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@@ -25,208 +18,212 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.mojang.authlib.GameProfile;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
|
import binnie.botany.api.IFlower;
|
||||||
|
import binnie.botany.api.IFlowerType;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import binnie.botany.gardening.Gardening;
|
||||||
|
import binnie.botany.genetics.EnumFlowerType;
|
||||||
|
import binnie.core.BinnieCore;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockFlower extends BlockContainer {
|
public class BlockFlower extends BlockContainer {
|
||||||
public BlockFlower() {
|
|
||||||
super(Material.plants);
|
|
||||||
float f = 0.2f;
|
|
||||||
setBlockBounds(0.5f - f, 0.0f, 0.5f - f, 0.5f + f, f * 3.0f, 0.5f + f);
|
|
||||||
setTickRandomly(true);
|
|
||||||
setBlockName("flower");
|
|
||||||
setStepSound(Block.soundTypeGrass);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public BlockFlower() {
|
||||||
public String getUnlocalizedName() {
|
super(Material.plants);
|
||||||
return "botany.flower";
|
float f = 0.2f;
|
||||||
}
|
setBlockBounds(0.5f - f, 0.0f, 0.5f - f, 0.5f + f, f * 3.0f, 0.5f + f);
|
||||||
|
setTickRandomly(true);
|
||||||
|
setBlockName("flower");
|
||||||
|
setStepSound(Block.soundTypeGrass);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public String getUnlocalizedName() {
|
||||||
return RendererBotany.renderID;
|
return "botany.flower";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public int getRenderType() {
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
return RendererBotany.renderID;
|
||||||
for (EnumFlowerType type : EnumFlowerType.values()) {
|
}
|
||||||
type.registerIcons(register);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
@SideOnly(Side.CLIENT)
|
||||||
return new TileEntityFlower();
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
}
|
for (EnumFlowerType type : EnumFlowerType.values()) {
|
||||||
|
type.registerIcons(register);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return null;
|
return new TileEntityFlower();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
public boolean renderAsNormalBlock() {
|
||||||
super.onBlockPlacedBy(world, x, y, z, entity, stack);
|
return false;
|
||||||
TileEntity flower = world.getTileEntity(x, y, z);
|
}
|
||||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
|
||||||
if (flower != null && flower instanceof TileEntityFlower) {
|
|
||||||
IFlower f = BotanyCore.getFlowerRoot().getMember(stack);
|
|
||||||
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TileEntity below = world.getTileEntity(x, y - 1, z);
|
@Override
|
||||||
if (flower != null && flower instanceof TileEntityFlower) {
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||||
if (below instanceof TileEntityFlower) {
|
super.onBlockPlacedBy(world, x, y, z, entity, stack);
|
||||||
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
|
TileEntity flower = world.getTileEntity(x, y, z);
|
||||||
} else {
|
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||||
GameProfile owner = (entity instanceof EntityPlayer) ? ((EntityPlayer) entity).getGameProfile() : null;
|
if (flower != null && flower instanceof TileEntityFlower) {
|
||||||
((TileEntityFlower) flower).create(stack, owner);
|
IFlower f = BotanyCore.getFlowerRoot().getMember(stack);
|
||||||
}
|
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
||||||
}
|
}
|
||||||
Gardening.tryGrowSection(world, x, y, z);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
TileEntity below = world.getTileEntity(x, y - 1, z);
|
||||||
@SideOnly(Side.CLIENT)
|
if (flower != null && flower instanceof TileEntityFlower) {
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
if (below instanceof TileEntityFlower) {
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
|
||||||
if (!(tile instanceof TileEntityFlower)) {
|
} else {
|
||||||
return super.getIcon(world, x, y, z, side);
|
GameProfile owner = (entity instanceof EntityPlayer) ? ((EntityPlayer) entity).getGameProfile() : null;
|
||||||
}
|
((TileEntityFlower) flower).create(stack, owner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Gardening.tryGrowSection(world, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
TileEntityFlower f = (TileEntityFlower) tile;
|
@Override
|
||||||
EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
@SideOnly(Side.CLIENT)
|
||||||
IFlowerType flower = f.getType();
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
int section = f.getRenderSection();
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
boolean flowered = f.isFlowered();
|
if (!(tile instanceof TileEntityFlower)) {
|
||||||
if (RendererBotany.pass == 0) {
|
return super.getIcon(world, x, y, z, side);
|
||||||
return flower.getStem(stage, flowered, section);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return (RendererBotany.pass == 1) ?
|
TileEntityFlower f = (TileEntityFlower) tile;
|
||||||
flower.getPetalIcon(stage, flowered, section) :
|
EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
||||||
flower.getVariantIcon(stage, flowered, section);
|
IFlowerType flower = f.getType();
|
||||||
}
|
int section = f.getRenderSection();
|
||||||
|
boolean flowered = f.isFlowered();
|
||||||
|
if (RendererBotany.pass == 0) {
|
||||||
|
return flower.getStem(stage, flowered, section);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
return (RendererBotany.pass == 1) ? flower.getPetalIcon(stage, flowered, section)
|
||||||
@SideOnly(Side.CLIENT)
|
: flower.getVariantIcon(stage, flowered, section);
|
||||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
}
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
|
||||||
if (tile instanceof TileEntityFlower) {
|
|
||||||
TileEntityFlower f = (TileEntityFlower) tile;
|
|
||||||
if (RendererBotany.pass == 0) {
|
|
||||||
return f.getStemColour();
|
|
||||||
}
|
|
||||||
return (RendererBotany.pass == 1) ?
|
|
||||||
f.getPrimaryColor() :
|
|
||||||
f.getSecondaryColor();
|
|
||||||
}
|
|
||||||
return 0xffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
|
@SideOnly(Side.CLIENT)
|
||||||
return super.canPlaceBlockAt(world, x, y, z)
|
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||||
&& canBlockStay(world, x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
}
|
if (tile instanceof TileEntityFlower) {
|
||||||
|
TileEntityFlower f = (TileEntityFlower) tile;
|
||||||
|
if (RendererBotany.pass == 0) {
|
||||||
|
return f.getStemColour();
|
||||||
|
}
|
||||||
|
return (RendererBotany.pass == 1) ? f.getPrimaryColor() : f.getSecondaryColor();
|
||||||
|
}
|
||||||
|
return 0xffffff;
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean canPlaceBlockOn(Block block) {
|
@Override
|
||||||
return block == Blocks.grass
|
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
|
||||||
|| block == Blocks.dirt
|
return super.canPlaceBlockAt(world, x, y, z) && canBlockStay(world, x, y, z);
|
||||||
|| block == Blocks.farmland
|
}
|
||||||
|| Gardening.isSoil(block);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
protected boolean canPlaceBlockOn(Block block) {
|
||||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || Gardening.isSoil(block);
|
||||||
super.onNeighborBlockChange(world, x, y, z, block);
|
}
|
||||||
checkAndDropBlock(world, x, y, z);
|
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
|
||||||
if (!(tile instanceof TileEntityFlower)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
@Override
|
||||||
if (flower.getSection() == 0
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||||
&& flower.getFlower() != null
|
super.onNeighborBlockChange(world, x, y, z, block);
|
||||||
&& flower.getFlower().getAge() > 0
|
checkAndDropBlock(world, x, y, z);
|
||||||
&& flower.getFlower().getGenome().getPrimary().getType().getSections() > 1
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
&& world.getBlock(x, y + 1, z) != Botany.flower) {
|
if (!(tile instanceof TileEntityFlower)) {
|
||||||
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
return;
|
||||||
world.setBlockToAir(x, y, z);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
if (flower.getSection() == 0 && flower.getFlower() != null
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
&& flower.getFlower().getAge() > 0
|
||||||
if (tile instanceof TileEntityFlower) {
|
&& flower.getFlower().getGenome().getPrimary().getType().getSections() > 1
|
||||||
((TileEntityFlower) tile).randomUpdate(rand);
|
&& world.getBlock(x, y + 1, z) != Botany.flower) {
|
||||||
checkAndDropBlock(world, x, y, z);
|
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||||
return;
|
world.setBlockToAir(x, y, z);
|
||||||
}
|
}
|
||||||
world.setBlockToAir(x, y, z);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected void checkAndDropBlock(World world, int x, int y, int z) {
|
@Override
|
||||||
if (!canBlockStay(world, x, y, z)) {
|
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||||
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
world.setBlockToAir(x, y, z);
|
if (tile instanceof TileEntityFlower) {
|
||||||
}
|
((TileEntityFlower) tile).randomUpdate(rand);
|
||||||
}
|
checkAndDropBlock(world, x, y, z);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
world.setBlockToAir(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
protected void checkAndDropBlock(World world, int x, int y, int z) {
|
||||||
public boolean canBlockStay(World world, int x, int y, int z) {
|
if (!canBlockStay(world, x, y, z)) {
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
|
world.setBlockToAir(x, y, z);
|
||||||
return world.getBlock(x, y - 1, z) == Botany.flower;
|
}
|
||||||
}
|
}
|
||||||
return canPlaceBlockOn(world.getBlock(x, y - 1, z));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
public boolean canBlockStay(World world, int x, int y, int z) {
|
||||||
ArrayList<ItemStack> drops = new ArrayList<>();
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
|
||||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
|
return world.getBlock(x, y - 1, z) == Botany.flower;
|
||||||
ItemStack flower = ((TileEntityFlower) tile).getItemStack();
|
}
|
||||||
if (flower != null) {
|
return canPlaceBlockOn(world.getBlock(x, y - 1, z));
|
||||||
drops.add(flower);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return drops;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||||
List<ItemStack> drops = getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
ArrayList<ItemStack> drops = new ArrayList<>();
|
||||||
boolean hasBeenBroken = world.setBlockToAir(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
|
||||||
for (ItemStack drop : drops) {
|
ItemStack flower = ((TileEntityFlower) tile).getItemStack();
|
||||||
dropBlockAsItem(world, x, y, z, drop);
|
if (flower != null) {
|
||||||
}
|
drops.add(flower);
|
||||||
}
|
}
|
||||||
return hasBeenBroken;
|
}
|
||||||
}
|
return drops;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||||
public IIcon getIcon(int meta, int side) {
|
List<ItemStack> drops = getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||||
return Blocks.yellow_flower.getIcon(0, 0);
|
boolean hasBeenBroken = world.setBlockToAir(x, y, z);
|
||||||
}
|
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world)
|
||||||
|
&& drops.size() > 0
|
||||||
|
&& (player == null || !player.capabilities.isCreativeMode)) {
|
||||||
|
for (ItemStack drop : drops) {
|
||||||
|
dropBlockAsItem(world, x, y, z, drop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hasBeenBroken;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public IIcon getIcon(int meta, int side) {
|
||||||
|
return Blocks.yellow_flower.getIcon(0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,19 @@
|
|||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import binnie.botany.CreativeTabBotany;
|
import binnie.botany.CreativeTabBotany;
|
||||||
@@ -18,272 +32,275 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||||||
import forestry.api.genetics.IIndividual;
|
import forestry.api.genetics.IIndividual;
|
||||||
import forestry.api.genetics.IPollinatable;
|
import forestry.api.genetics.IPollinatable;
|
||||||
import forestry.core.config.Config;
|
import forestry.core.config.Config;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class ItemBotany extends Item {
|
public abstract class ItemBotany extends Item {
|
||||||
public ItemBotany(String name) {
|
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
setUnlocalizedName(name);
|
|
||||||
hasSubtypes = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ItemBotany(String name) {
|
||||||
@SideOnly(Side.CLIENT)
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
public int getSpriteNumber() {
|
setUnlocalizedName(name);
|
||||||
return 0;
|
hasSubtypes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDamageable() {
|
@SideOnly(Side.CLIENT)
|
||||||
return false;
|
public int getSpriteNumber() {
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRepairable() {
|
public boolean isDamageable() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getShareTag() {
|
public boolean isRepairable() {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasEffect(ItemStack stack, int pass) {
|
public boolean getShareTag() {
|
||||||
if (!stack.hasTagCompound()) {
|
return true;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
IIndividual individual = getIndividual(stack);
|
@Override
|
||||||
return individual != null
|
public boolean hasEffect(ItemStack stack, int pass) {
|
||||||
&& individual.getGenome() != null
|
if (!stack.hasTagCompound()) {
|
||||||
&& individual.hasEffect();
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
IIndividual individual = getIndividual(stack);
|
||||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List tooltip, boolean flag) {
|
return individual != null && individual.getGenome() != null && individual.hasEffect();
|
||||||
if (!itemstack.hasTagCompound()) {
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
IFlower individual = (IFlower) getIndividual(itemstack);
|
|
||||||
if (individual == null) {
|
|
||||||
tooltip.add(I18N.localise("botany.item.tooltip.bugged"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IFlowerGenome genome = individual.getGenome();
|
@Override
|
||||||
IFlowerColor primaryColor = genome.getPrimaryColor();
|
public void addInformation(ItemStack itemstack, EntityPlayer player, List tooltip, boolean flag) {
|
||||||
IFlowerColor secondColor = genome.getSecondaryColor();
|
if (!itemstack.hasTagCompound()) {
|
||||||
IFlowerColor stemColor = genome.getStemColor();
|
return;
|
||||||
|
}
|
||||||
|
IFlower individual = (IFlower) getIndividual(itemstack);
|
||||||
|
if (individual == null) {
|
||||||
|
tooltip.add(I18N.localise("botany.item.tooltip.bugged"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (primaryColor == secondColor) {
|
IFlowerGenome genome = individual.getGenome();
|
||||||
tooltip.add(EnumChatFormatting.YELLOW + I18N.localise("botany.item.tooltip.flowerColor1", primaryColor.getName(), stemColor.getName()));
|
IFlowerColor primaryColor = genome.getPrimaryColor();
|
||||||
} else {
|
IFlowerColor secondColor = genome.getSecondaryColor();
|
||||||
tooltip.add(EnumChatFormatting.YELLOW + I18N.localise("botany.item.tooltip.flowerColor2", primaryColor.getName(), secondColor.getName(), stemColor.getName()));
|
IFlowerColor stemColor = genome.getStemColor();
|
||||||
}
|
|
||||||
|
|
||||||
if (individual.isAnalyzed()) {
|
if (primaryColor == secondColor) {
|
||||||
if (BinnieCore.proxy.isShiftDown()) {
|
tooltip.add(
|
||||||
individual.addTooltip(tooltip);
|
EnumChatFormatting.YELLOW + I18N
|
||||||
} else {
|
.localise("botany.item.tooltip.flowerColor1", primaryColor.getName(), stemColor.getName()));
|
||||||
tooltip.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.holdMore"));
|
} else {
|
||||||
}
|
tooltip.add(
|
||||||
} else {
|
EnumChatFormatting.YELLOW + I18N.localise(
|
||||||
tooltip.add(I18N.localise("botany.item.tooltip.unknownGenome"));
|
"botany.item.tooltip.flowerColor2",
|
||||||
}
|
primaryColor.getName(),
|
||||||
}
|
secondColor.getName(),
|
||||||
|
stemColor.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
if (individual.isAnalyzed()) {
|
||||||
@SideOnly(Side.CLIENT)
|
if (BinnieCore.proxy.isShiftDown()) {
|
||||||
public void registerIcons(IIconRegister par1IconRegister) {
|
individual.addTooltip(tooltip);
|
||||||
}
|
} else {
|
||||||
|
tooltip.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.holdMore"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tooltip.add(I18N.localise("botany.item.tooltip.unknownGenome"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected IIndividual getIndividual(ItemStack itemstack) {
|
@Override
|
||||||
return new Flower(itemstack.getTagCompound());
|
@SideOnly(Side.CLIENT)
|
||||||
}
|
public void registerIcons(IIconRegister par1IconRegister) {}
|
||||||
|
|
||||||
@Override
|
protected IIndividual getIndividual(ItemStack itemstack) {
|
||||||
public String getItemStackDisplayName(ItemStack itemstack) {
|
return new Flower(itemstack.getTagCompound());
|
||||||
if (!itemstack.hasTagCompound()) {
|
}
|
||||||
return I18N.localise("botany.item.tooltip.unknown");
|
|
||||||
}
|
|
||||||
|
|
||||||
IIndividual individual = getIndividual(itemstack);
|
@Override
|
||||||
if (individual != null && individual.getGenome() != null) {
|
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||||
String tag = getTag();
|
if (!itemstack.hasTagCompound()) {
|
||||||
if (tag == null || tag.isEmpty()) {
|
return I18N.localise("botany.item.tooltip.unknown");
|
||||||
return individual.getDisplayName();
|
}
|
||||||
}
|
|
||||||
return I18N.localise("botany.item.botany.name", individual.getDisplayName(), tag);
|
|
||||||
}
|
|
||||||
return I18N.localise("botany.item.flowerCorrupted.name");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
IIndividual individual = getIndividual(itemstack);
|
||||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
if (individual != null && individual.getGenome() != null) {
|
||||||
addCreativeItems(itemList, true);
|
String tag = getTag();
|
||||||
}
|
if (tag == null || tag.isEmpty()) {
|
||||||
|
return individual.getDisplayName();
|
||||||
|
}
|
||||||
|
return I18N.localise("botany.item.botany.name", individual.getDisplayName(), tag);
|
||||||
|
}
|
||||||
|
return I18N.localise("botany.item.flowerCorrupted.name");
|
||||||
|
}
|
||||||
|
|
||||||
public void addCreativeItems(List itemList, boolean hideSecrets) {
|
@Override
|
||||||
for (IIndividual individual : BotanyCore.speciesRoot.getIndividualTemplates()) {
|
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||||
if (hideSecrets && individual.isSecret() && !Config.isDebug) {
|
addCreativeItems(itemList, true);
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
itemList.add(BotanyCore.speciesRoot.getMemberStack(individual.copy(), getStage().ordinal()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public void addCreativeItems(List itemList, boolean hideSecrets) {
|
||||||
public int getColorFromItemStack(ItemStack itemstack, int renderPass) {
|
for (IIndividual individual : BotanyCore.speciesRoot.getIndividualTemplates()) {
|
||||||
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
if (hideSecrets && individual.isSecret() && !Config.isDebug) {
|
||||||
if (flower == null || flower.getGenome() == null) {
|
continue;
|
||||||
return 0xffffff;
|
}
|
||||||
}
|
itemList.add(BotanyCore.speciesRoot.getMemberStack(individual.copy(), getStage().ordinal()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (renderPass == 0) {
|
@Override
|
||||||
return flower.getGenome().getStemColor().getColor(flower.isWilted());
|
public int getColorFromItemStack(ItemStack itemstack, int renderPass) {
|
||||||
}
|
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||||
return (renderPass == 1) ?
|
if (flower == null || flower.getGenome() == null) {
|
||||||
flower.getGenome().getPrimaryColor().getColor(flower.isWilted()) :
|
return 0xffffff;
|
||||||
flower.getGenome().getSecondaryColor().getColor(flower.isWilted());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
if (renderPass == 0) {
|
||||||
public boolean requiresMultipleRenderPasses() {
|
return flower.getGenome().getStemColor().getColor(flower.isWilted());
|
||||||
return true;
|
}
|
||||||
}
|
return (renderPass == 1) ? flower.getGenome().getPrimaryColor().getColor(flower.isWilted())
|
||||||
|
: flower.getGenome().getSecondaryColor().getColor(flower.isWilted());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderPasses(int metadata) {
|
public boolean requiresMultipleRenderPasses() {
|
||||||
return 3;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public int getRenderPasses(int metadata) {
|
||||||
public IIcon getIcon(ItemStack itemstack, int renderPass) {
|
return 3;
|
||||||
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
}
|
||||||
if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
|
|
||||||
return EnumFlowerType.ALLIUM.getBlank();
|
|
||||||
}
|
|
||||||
|
|
||||||
IFlowerType type = flower.getGenome().getPrimary().getType();
|
@Override
|
||||||
if (renderPass == 0) {
|
@SideOnly(Side.CLIENT)
|
||||||
return type.getStem(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
public IIcon getIcon(ItemStack itemstack, int renderPass) {
|
||||||
}
|
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||||
if (renderPass == 1) {
|
if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
|
||||||
return type.getPetalIcon(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
return EnumFlowerType.ALLIUM.getBlank();
|
||||||
}
|
}
|
||||||
return type.getVariantIcon(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
IFlowerType type = flower.getGenome().getPrimary().getType();
|
||||||
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float px, float py, float pz) {
|
if (renderPass == 0) {
|
||||||
if (getStage() == EnumFlowerStage.POLLEN) {
|
return type.getStem(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||||
IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(itemstack);
|
}
|
||||||
TileEntity target = world.getTileEntity(x, y, z);
|
if (renderPass == 1) {
|
||||||
if (!(target instanceof IPollinatable)) {
|
return type.getPetalIcon(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||||
return false;
|
}
|
||||||
}
|
return type.getVariantIcon(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||||
IPollinatable pollinatable = (IPollinatable) target;
|
}
|
||||||
if (!pollinatable.canMateWith(flower)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
pollinatable.mateWith(flower);
|
|
||||||
if (!player.capabilities.isCreativeMode) {
|
|
||||||
itemstack.stackSize--;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Block blockFlower = Botany.flower;
|
@Override
|
||||||
Block blockAlreadyThere = world.getBlock(x, y, z);
|
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||||
if (blockAlreadyThere == Blocks.snow_layer && (world.getBlockMetadata(x, y, z) & 0x7) < 1) {
|
float px, float py, float pz) {
|
||||||
side = 1;
|
if (getStage() == EnumFlowerStage.POLLEN) {
|
||||||
} else if (blockAlreadyThere != Blocks.vine && blockAlreadyThere != Blocks.tallgrass && blockAlreadyThere != Blocks.deadbush && !blockAlreadyThere.isReplaceable(world, x, y, z)) {
|
IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(itemstack);
|
||||||
if (side == 0) {
|
TileEntity target = world.getTileEntity(x, y, z);
|
||||||
y--;
|
if (!(target instanceof IPollinatable)) {
|
||||||
} else if (side == 1) {
|
return false;
|
||||||
y++;
|
}
|
||||||
} else if (side == 2) {
|
IPollinatable pollinatable = (IPollinatable) target;
|
||||||
z--;
|
if (!pollinatable.canMateWith(flower)) {
|
||||||
} else if (side == 3) {
|
return false;
|
||||||
z++;
|
}
|
||||||
} else if (side == 4) {
|
pollinatable.mateWith(flower);
|
||||||
x--;
|
if (!player.capabilities.isCreativeMode) {
|
||||||
} else if (side == 5) {
|
itemstack.stackSize--;
|
||||||
x++;
|
}
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemstack.stackSize == 0 || !player.canPlayerEdit(x, y, z, side, itemstack)) {
|
Block blockFlower = Botany.flower;
|
||||||
return false;
|
Block blockAlreadyThere = world.getBlock(x, y, z);
|
||||||
}
|
if (blockAlreadyThere == Blocks.snow_layer && (world.getBlockMetadata(x, y, z) & 0x7) < 1) {
|
||||||
if (y == 255 && blockFlower.getMaterial().isSolid()) {
|
side = 1;
|
||||||
return false;
|
} else if (blockAlreadyThere != Blocks.vine && blockAlreadyThere != Blocks.tallgrass
|
||||||
}
|
&& blockAlreadyThere != Blocks.deadbush
|
||||||
|
&& !blockAlreadyThere.isReplaceable(world, x, y, z)) {
|
||||||
|
if (side == 0) {
|
||||||
|
y--;
|
||||||
|
} else if (side == 1) {
|
||||||
|
y++;
|
||||||
|
} else if (side == 2) {
|
||||||
|
z--;
|
||||||
|
} else if (side == 3) {
|
||||||
|
z++;
|
||||||
|
} else if (side == 4) {
|
||||||
|
x--;
|
||||||
|
} else if (side == 5) {
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (world.canPlaceEntityOnSide(blockFlower, x, y, z, false, side, player, itemstack)) {
|
if (itemstack.stackSize == 0 || !player.canPlayerEdit(x, y, z, side, itemstack)) {
|
||||||
int i1 = getMetadata(itemstack.getItemDamage());
|
return false;
|
||||||
int j1 = blockFlower.onBlockPlaced(world, x, y, z, side, px, py, pz, i1);
|
}
|
||||||
if (placeBlockAt(itemstack, player, world, x, y, z, side, px, py, pz, j1)) {
|
if (y == 255 && blockFlower.getMaterial().isSolid()) {
|
||||||
world.playSoundEffect(x + 0.5f, y + 0.5f, z + 0.5f, blockFlower.stepSound.func_150496_b(), (blockFlower.stepSound.getVolume() + 1.0f) / 2.0f, blockFlower.stepSound.getPitch() * 0.8f);
|
return false;
|
||||||
itemstack.stackSize--;
|
}
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
if (world.canPlaceEntityOnSide(blockFlower, x, y, z, false, side, player, itemstack)) {
|
||||||
public boolean func_150936_a(World world, int x, int y, int z, int side, EntityPlayer player, ItemStack stack) {
|
int i1 = getMetadata(itemstack.getItemDamage());
|
||||||
Block field_150939_a = Botany.flower;
|
int j1 = blockFlower.onBlockPlaced(world, x, y, z, side, px, py, pz, i1);
|
||||||
Block block = world.getBlock(x, y, z);
|
if (placeBlockAt(itemstack, player, world, x, y, z, side, px, py, pz, j1)) {
|
||||||
if (block == Blocks.snow_layer) {
|
world.playSoundEffect(
|
||||||
side = 1;
|
x + 0.5f,
|
||||||
} else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush && !block.isReplaceable(world, x, y, z)) {
|
y + 0.5f,
|
||||||
if (side == 0) {
|
z + 0.5f,
|
||||||
y--;
|
blockFlower.stepSound.func_150496_b(),
|
||||||
} else if (side == 1) {
|
(blockFlower.stepSound.getVolume() + 1.0f) / 2.0f,
|
||||||
y++;
|
blockFlower.stepSound.getPitch() * 0.8f);
|
||||||
} else if (side == 2) {
|
itemstack.stackSize--;
|
||||||
z--;
|
}
|
||||||
} else if (side == 3) {
|
return true;
|
||||||
z++;
|
}
|
||||||
} else if (side == 4) {
|
return false;
|
||||||
x--;
|
}
|
||||||
} else if (side == 5) {
|
|
||||||
x++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return world.canPlaceEntityOnSide(field_150939_a, x, y, z, false, side, null, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
|
@SideOnly(Side.CLIENT)
|
||||||
Block block = Botany.flower;
|
public boolean func_150936_a(World world, int x, int y, int z, int side, EntityPlayer player, ItemStack stack) {
|
||||||
if (!world.setBlock(x, y, z, block, metadata, 3)) {
|
Block field_150939_a = Botany.flower;
|
||||||
return false;
|
Block block = world.getBlock(x, y, z);
|
||||||
}
|
if (block == Blocks.snow_layer) {
|
||||||
|
side = 1;
|
||||||
|
} else if (block != Blocks.vine && block != Blocks.tallgrass
|
||||||
|
&& block != Blocks.deadbush
|
||||||
|
&& !block.isReplaceable(world, x, y, z)) {
|
||||||
|
if (side == 0) {
|
||||||
|
y--;
|
||||||
|
} else if (side == 1) {
|
||||||
|
y++;
|
||||||
|
} else if (side == 2) {
|
||||||
|
z--;
|
||||||
|
} else if (side == 3) {
|
||||||
|
z++;
|
||||||
|
} else if (side == 4) {
|
||||||
|
x--;
|
||||||
|
} else if (side == 5) {
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return world.canPlaceEntityOnSide(field_150939_a, x, y, z, false, side, null, stack);
|
||||||
|
}
|
||||||
|
|
||||||
if (world.getBlock(x, y, z) == block) {
|
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||||
block.onBlockPlacedBy(world, x, y, z, player, stack);
|
float hitX, float hitY, float hitZ, int metadata) {
|
||||||
block.onPostBlockPlaced(world, x, y, z, metadata);
|
Block block = Botany.flower;
|
||||||
}
|
if (!world.setBlock(x, y, z, block, metadata, 3)) {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract EnumFlowerStage getStage();
|
if (world.getBlock(x, y, z) == block) {
|
||||||
|
block.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||||
|
block.onPostBlockPlaced(world, x, y, z, metadata);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract String getTag();
|
public abstract EnumFlowerStage getStage();
|
||||||
|
|
||||||
|
public abstract String getTag();
|
||||||
}
|
}
|
||||||
@@ -3,17 +3,18 @@ package binnie.botany.flower;
|
|||||||
import binnie.botany.api.EnumFlowerStage;
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
|
|
||||||
public class ItemFlower extends ItemBotany {
|
public class ItemFlower extends ItemBotany {
|
||||||
public ItemFlower() {
|
|
||||||
super("itemFlower");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ItemFlower() {
|
||||||
public EnumFlowerStage getStage() {
|
super("itemFlower");
|
||||||
return EnumFlowerStage.FLOWER;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTag() {
|
public EnumFlowerStage getStage() {
|
||||||
return "";
|
return EnumFlowerStage.FLOWER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTag() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,7 @@
|
|||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import java.util.List;
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import binnie.core.util.I18N;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -13,155 +10,160 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
import java.util.List;
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.CreativeTabBotany;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class ItemInsulatedTube extends Item {
|
public class ItemInsulatedTube extends Item {
|
||||||
IIcon[] icons;
|
|
||||||
|
|
||||||
public ItemInsulatedTube() {
|
IIcon[] icons;
|
||||||
icons = new IIcon[3];
|
|
||||||
setUnlocalizedName("insulatedTube");
|
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
setHasSubtypes(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getInsulateStack(ItemStack stack) {
|
public ItemInsulatedTube() {
|
||||||
return Insulate.get(stack.getItemDamage()).getStack();
|
icons = new IIcon[3];
|
||||||
}
|
setUnlocalizedName("insulatedTube");
|
||||||
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
setHasSubtypes(true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
public static ItemStack getInsulateStack(ItemStack stack) {
|
||||||
@SideOnly(Side.CLIENT)
|
return Insulate.get(stack.getItemDamage()).getStack();
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
}
|
||||||
for (Material mat : Material.values()) {
|
|
||||||
for (Insulate ins : Insulate.values()) {
|
|
||||||
list.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(IIconRegister register) {
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (Material mat : Material.values()) {
|
||||||
icons[i] = Botany.proxy.getIcon(register, "insulatedTube." + i);
|
for (Insulate ins : Insulate.values()) {
|
||||||
}
|
list.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getColorFromItemStack(ItemStack stack, int pass) {
|
public void registerIcons(IIconRegister register) {
|
||||||
if (pass == 0) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
return 0xffffff;
|
icons[i] = Botany.proxy.getIcon(register, "insulatedTube." + i);
|
||||||
}
|
}
|
||||||
return (pass == 1)
|
}
|
||||||
? Material.get(stack.getItemDamage()).getColor()
|
|
||||||
: Insulate.get(stack.getItemDamage()).getColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
public int getColorFromItemStack(ItemStack stack, int pass) {
|
||||||
super.addInformation(stack, player, tooltip, advanced);
|
if (pass == 0) {
|
||||||
tooltip.add(Insulate.get(stack.getItemDamage()).getName());
|
return 0xffffff;
|
||||||
}
|
}
|
||||||
|
return (pass == 1) ? Material.get(stack.getItemDamage()).getColor()
|
||||||
|
: Insulate.get(stack.getItemDamage()).getColor();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(ItemStack stack) {
|
@SideOnly(Side.CLIENT)
|
||||||
return Material.get(stack.getItemDamage()).getName() + " "
|
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||||
+ I18N.localise("botany.tube.name");
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
}
|
tooltip.add(Insulate.get(stack.getItemDamage()).getName());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderPasses(int metadata) {
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
return 3;
|
return Material.get(stack.getItemDamage()).getName() + " " + I18N.localise("botany.tube.name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(ItemStack stack, int pass) {
|
public int getRenderPasses(int metadata) {
|
||||||
return icons[pass % 3];
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean requiresMultipleRenderPasses() {
|
public IIcon getIcon(ItemStack stack, int pass) {
|
||||||
return true;
|
return icons[pass % 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Material {
|
@Override
|
||||||
Copper(0xe3b78e, "cooper"),
|
public boolean requiresMultipleRenderPasses() {
|
||||||
Tin(0xe1eef4, "tin"),
|
return true;
|
||||||
Bronze(0xddc276, "bronze"),
|
}
|
||||||
Iron(0xd8d8d8, "iron");
|
|
||||||
|
|
||||||
protected int color;
|
enum Material {
|
||||||
protected String name;
|
|
||||||
|
|
||||||
Material(int color, String name) {
|
Copper(0xe3b78e, "copper"),
|
||||||
this.color = color;
|
Tin(0xe1eef4, "tin"),
|
||||||
this.name = name;
|
Bronze(0xddc276, "bronze"),
|
||||||
}
|
Iron(0xd8d8d8, "iron");
|
||||||
|
|
||||||
public static Material get(int i) {
|
protected int color;
|
||||||
return values()[i % values().length];
|
protected String name;
|
||||||
}
|
|
||||||
|
|
||||||
public int getColor() {
|
Material(int color, String name) {
|
||||||
return color;
|
this.color = color;
|
||||||
}
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public static Material get(int i) {
|
||||||
return I18N.localise("botany.tube." + name);
|
return values()[i % values().length];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
enum Insulate {
|
public int getColor() {
|
||||||
Clay(0xa1aacc, "clay"),
|
return color;
|
||||||
Cobble(0x7b7b7b, "cobblestone"),
|
}
|
||||||
Sand(0xefeab5, "sand"),
|
|
||||||
HardenedClay(0x935c43, "hardenedClay"),
|
|
||||||
Stone(0x6d6d6d, "smoothStone"),
|
|
||||||
Sandstone(0xc1b989, "sandstone");
|
|
||||||
|
|
||||||
protected int color;
|
public String getName() {
|
||||||
protected String name;
|
return I18N.localise("botany.tube." + name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Insulate(int color, String name) {
|
enum Insulate {
|
||||||
this.color = color;
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Insulate get(int i) {
|
Clay(0xa1aacc, "clay"),
|
||||||
return values()[i / 128 % values().length];
|
Cobble(0x7b7b7b, "cobblestone"),
|
||||||
}
|
Sand(0xefeab5, "sand"),
|
||||||
|
HardenedClay(0x935c43, "hardenedClay"),
|
||||||
|
Stone(0x6d6d6d, "smoothStone"),
|
||||||
|
Sandstone(0xc1b989, "sandstone");
|
||||||
|
|
||||||
public int getColor() {
|
protected int color;
|
||||||
return color;
|
protected String name;
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
Insulate(int color, String name) {
|
||||||
return I18N.localise("botany.tube.insulate." + name);
|
this.color = color;
|
||||||
}
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
public ItemStack getStack() {
|
public static Insulate get(int i) {
|
||||||
switch (this) {
|
return values()[i / 128 % values().length];
|
||||||
case Clay:
|
}
|
||||||
return new ItemStack(Blocks.clay);
|
|
||||||
|
|
||||||
case Cobble:
|
public int getColor() {
|
||||||
return new ItemStack(Blocks.cobblestone);
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
case HardenedClay:
|
public String getName() {
|
||||||
return new ItemStack(Blocks.hardened_clay);
|
return I18N.localise("botany.tube.insulate." + name);
|
||||||
|
}
|
||||||
|
|
||||||
case Sand:
|
public ItemStack getStack() {
|
||||||
return new ItemStack(Blocks.sand);
|
switch (this) {
|
||||||
|
case Clay:
|
||||||
|
return new ItemStack(Blocks.clay);
|
||||||
|
|
||||||
case Sandstone:
|
case Cobble:
|
||||||
return new ItemStack(Blocks.sandstone);
|
return new ItemStack(Blocks.cobblestone);
|
||||||
|
|
||||||
case Stone:
|
case HardenedClay:
|
||||||
return new ItemStack(Blocks.stone);
|
return new ItemStack(Blocks.hardened_clay);
|
||||||
}
|
|
||||||
return null;
|
case Sand:
|
||||||
}
|
return new ItemStack(Blocks.sand);
|
||||||
}
|
|
||||||
|
case Sandstone:
|
||||||
|
return new ItemStack(Blocks.sandstone);
|
||||||
|
|
||||||
|
case Stone:
|
||||||
|
return new ItemStack(Blocks.stone);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,17 +4,18 @@ import binnie.botany.api.EnumFlowerStage;
|
|||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
public class ItemPollen extends ItemBotany {
|
public class ItemPollen extends ItemBotany {
|
||||||
public ItemPollen() {
|
|
||||||
super("pollen");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ItemPollen() {
|
||||||
public EnumFlowerStage getStage() {
|
super("pollen");
|
||||||
return EnumFlowerStage.POLLEN;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTag() {
|
public EnumFlowerStage getStage() {
|
||||||
return I18N.localise("botany.item.pollen.tag.name");
|
return EnumFlowerStage.POLLEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTag() {
|
||||||
|
return I18N.localise("botany.item.pollen.tag.name");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,17 +4,18 @@ import binnie.botany.api.EnumFlowerStage;
|
|||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
public class ItemSeed extends ItemBotany {
|
public class ItemSeed extends ItemBotany {
|
||||||
public ItemSeed() {
|
|
||||||
super("seed");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ItemSeed() {
|
||||||
public EnumFlowerStage getStage() {
|
super("seed");
|
||||||
return EnumFlowerStage.SEED;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTag() {
|
public EnumFlowerStage getStage() {
|
||||||
return I18N.localise("botany.item.germling.tag.name");
|
return EnumFlowerStage.SEED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTag() {
|
||||||
|
return I18N.localise("botany.item.germling.tag.name");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.EntityRenderer;
|
import net.minecraft.client.renderer.EntityRenderer;
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
@@ -8,53 +7,57 @@ import net.minecraft.client.renderer.Tessellator;
|
|||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||||
|
|
||||||
public class RendererBotany implements ISimpleBlockRenderingHandler {
|
public class RendererBotany implements ISimpleBlockRenderingHandler {
|
||||||
public static int renderID;
|
|
||||||
public static int pass;
|
|
||||||
|
|
||||||
@Override
|
public static int renderID;
|
||||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
public static int pass;
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||||
Tessellator tessellator = Tessellator.instance;
|
// ignored
|
||||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z));
|
}
|
||||||
double d1 = x;
|
|
||||||
double d2 = y;
|
|
||||||
double d3 = z;
|
|
||||||
long i1 = x * 3129871 ^ z * 116129781L;
|
|
||||||
i1 = i1 * i1 * 42317861L + i1 * 11L;
|
|
||||||
d1 += ((i1 >> 16 & 0xFL) / 15.0f - 0.5) * 0.3;
|
|
||||||
d3 += ((i1 >> 24 & 0xFL) / 15.0f - 0.5) * 0.3;
|
|
||||||
|
|
||||||
for (int j = 0; j < 3; ++j) {
|
@Override
|
||||||
RendererBotany.pass = j;
|
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||||
int l = block.colorMultiplier(renderer.blockAccess, x, y, z);
|
RenderBlocks renderer) {
|
||||||
float f = (l >> 16 & 0xFF) / 255.0f;
|
Tessellator tessellator = Tessellator.instance;
|
||||||
float f2 = (l >> 8 & 0xFF) / 255.0f;
|
tessellator.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z));
|
||||||
float f3 = (l & 0xFF) / 255.0f;
|
double d1 = x;
|
||||||
|
double d2 = y;
|
||||||
|
double d3 = z;
|
||||||
|
long i1 = x * 3129871 ^ z * 116129781L;
|
||||||
|
i1 = i1 * i1 * 42317861L + i1 * 11L;
|
||||||
|
d1 += ((i1 >> 16 & 0xFL) / 15.0f - 0.5) * 0.3;
|
||||||
|
d3 += ((i1 >> 24 & 0xFL) / 15.0f - 0.5) * 0.3;
|
||||||
|
|
||||||
if (EntityRenderer.anaglyphEnable) {
|
for (int j = 0; j < 3; ++j) {
|
||||||
f = (f * 30.0f + f2 * 59.0f + f3 * 11.0f) / 100.0f;
|
RendererBotany.pass = j;
|
||||||
f2 = (f * 30.0f + f2 * 70.0f) / 100.0f;
|
int l = block.colorMultiplier(renderer.blockAccess, x, y, z);
|
||||||
f3 = (f * 30.0f + f3 * 70.0f) / 100.0f;
|
float f = (l >> 16 & 0xFF) / 255.0f;
|
||||||
}
|
float f2 = (l >> 8 & 0xFF) / 255.0f;
|
||||||
tessellator.setColorOpaque_F(f, f2, f3);
|
float f3 = (l & 0xFF) / 255.0f;
|
||||||
IIcon iicon = block.getIcon(world, x, y, z, 0);
|
|
||||||
renderer.drawCrossedSquares(iicon, d1, d2, d3, 1.0f);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
if (EntityRenderer.anaglyphEnable) {
|
||||||
public boolean shouldRender3DInInventory(int i) {
|
f = (f * 30.0f + f2 * 59.0f + f3 * 11.0f) / 100.0f;
|
||||||
return false;
|
f2 = (f * 30.0f + f2 * 70.0f) / 100.0f;
|
||||||
}
|
f3 = (f * 30.0f + f3 * 70.0f) / 100.0f;
|
||||||
|
}
|
||||||
|
tessellator.setColorOpaque_F(f, f2, f3);
|
||||||
|
IIcon iicon = block.getIcon(world, x, y, z, 0);
|
||||||
|
renderer.drawCrossedSquares(iicon, d1, d2, d3, 1.0f);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderId() {
|
public boolean shouldRender3DInInventory(int i) {
|
||||||
return RendererBotany.renderID;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRenderId() {
|
||||||
|
return RendererBotany.renderID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,12 +1,9 @@
|
|||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import java.util.ArrayList;
|
||||||
import binnie.botany.CreativeTabBotany;
|
import java.util.List;
|
||||||
import binnie.botany.api.EnumSoilType;
|
import java.util.Random;
|
||||||
import binnie.botany.api.gardening.IBlockSoil;
|
|
||||||
import binnie.core.util.I18N;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockBush;
|
import net.minecraft.block.BlockBush;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -17,141 +14,145 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import binnie.botany.Botany;
|
||||||
import java.util.List;
|
import binnie.botany.CreativeTabBotany;
|
||||||
import java.util.Random;
|
import binnie.botany.api.EnumSoilType;
|
||||||
|
import binnie.botany.api.gardening.IBlockSoil;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockPlant extends BlockBush {
|
public class BlockPlant extends BlockBush {
|
||||||
public BlockPlant() {
|
|
||||||
setBlockName("plant");
|
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
setTickRandomly(true);
|
|
||||||
setStepSound(Block.soundTypeGrass);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isWeed(IBlockAccess world, int x, int y, int z) {
|
public BlockPlant() {
|
||||||
if (!(world.getBlock(x, y, z) instanceof BlockPlant)) {
|
setBlockName("plant");
|
||||||
return false;
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
}
|
setTickRandomly(true);
|
||||||
|
setStepSound(Block.soundTypeGrass);
|
||||||
|
}
|
||||||
|
|
||||||
Type type = Type.get(world.getBlockMetadata(x, y, z));
|
public static boolean isWeed(IBlockAccess world, int x, int y, int z) {
|
||||||
return type == Type.Weeds
|
if (!(world.getBlock(x, y, z) instanceof BlockPlant)) {
|
||||||
|| type == Type.WeedsLong
|
return false;
|
||||||
|| type == Type.WeedsVeryLong;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
Type type = Type.get(world.getBlockMetadata(x, y, z));
|
||||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
return type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong;
|
||||||
return new ArrayList<>();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
return new ArrayList<>();
|
||||||
for (Type t : Type.values()) {
|
}
|
||||||
t.icon = Botany.proxy.getIcon(register, t.name().toLowerCase());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canPlaceBlockOn(Block block) {
|
@SideOnly(Side.CLIENT)
|
||||||
return super.canPlaceBlockOn(block) || Gardening.isSoil(block);
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
}
|
for (Type t : Type.values()) {
|
||||||
|
t.icon = Botany.proxy.getIcon(register, t.name().toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
protected boolean canPlaceBlockOn(Block block) {
|
||||||
public IIcon getIcon(int side, int meta) {
|
return super.canPlaceBlockOn(block) || Gardening.isSoil(block);
|
||||||
return Type.values()[meta % Type.values().length].icon;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int damage) {
|
@SideOnly(Side.CLIENT)
|
||||||
return damage;
|
public IIcon getIcon(int side, int meta) {
|
||||||
}
|
return Type.values()[meta % Type.values().length].icon;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public int damageDropped(int damage) {
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
return damage;
|
||||||
for (Type type : Type.values()) {
|
}
|
||||||
list.add(type.get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
@SideOnly(Side.CLIENT)
|
||||||
Type type = Type.get(world.getBlockMetadata(x, y, z));
|
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||||
if (random.nextInt(4) == 0) {
|
for (Type type : Type.values()) {
|
||||||
if (type == Type.Weeds) {
|
list.add(type.get());
|
||||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
|
}
|
||||||
} else if (type == Type.WeedsLong) {
|
}
|
||||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsVeryLong.ordinal(), 2);
|
|
||||||
} else if (type == Type.DeadFlower) {
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, Type.DecayingFlower.ordinal(), 2);
|
|
||||||
} else if (type == Type.DecayingFlower) {
|
|
||||||
world.setBlockToAir(x, y, z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (random.nextInt(6) == 0) {
|
@Override
|
||||||
if (type == Type.Weeds) {
|
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||||
world.setBlockToAir(x, y, z);
|
Type type = Type.get(world.getBlockMetadata(x, y, z));
|
||||||
} else if (type == Type.WeedsLong) {
|
if (random.nextInt(4) == 0) {
|
||||||
world.setBlockMetadataWithNotify(x, y, z, Type.Weeds.ordinal(), 2);
|
if (type == Type.Weeds) {
|
||||||
} else if (type == Type.WeedsVeryLong) {
|
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
|
||||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
|
} else if (type == Type.WeedsLong) {
|
||||||
}
|
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsVeryLong.ordinal(), 2);
|
||||||
}
|
} else if (type == Type.DeadFlower) {
|
||||||
|
world.setBlockMetadataWithNotify(x, y, z, Type.DecayingFlower.ordinal(), 2);
|
||||||
|
} else if (type == Type.DecayingFlower) {
|
||||||
|
world.setBlockToAir(x, y, z);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Block below = world.getBlock(x, y - 1, z);
|
if (random.nextInt(6) == 0) {
|
||||||
if (!Gardening.isSoil(below)) {
|
if (type == Type.Weeds) {
|
||||||
return;
|
world.setBlockToAir(x, y, z);
|
||||||
}
|
} else if (type == Type.WeedsLong) {
|
||||||
|
world.setBlockMetadataWithNotify(x, y, z, Type.Weeds.ordinal(), 2);
|
||||||
|
} else if (type == Type.WeedsVeryLong) {
|
||||||
|
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IBlockSoil soil = (IBlockSoil) below;
|
Block below = world.getBlock(x, y - 1, z);
|
||||||
if (random.nextInt(3) != 0) {
|
if (!Gardening.isSoil(below)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong) {
|
IBlockSoil soil = (IBlockSoil) below;
|
||||||
if (!soil.degrade(world, x, y - 1, z, EnumSoilType.LOAM)) {
|
if (random.nextInt(3) != 0) {
|
||||||
soil.degrade(world, x, y - 1, z, EnumSoilType.SOIL);
|
return;
|
||||||
}
|
}
|
||||||
} else if (type == Type.DecayingFlower && !soil.fertilise(world, x, y - 1, z, EnumSoilType.LOAM)) {
|
|
||||||
soil.fertilise(world, x, y - 1, z, EnumSoilType.FLOWERBED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
if (type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong) {
|
||||||
public boolean isReplaceable(IBlockAccess world, int x, int y, int z) {
|
if (!soil.degrade(world, x, y - 1, z, EnumSoilType.LOAM)) {
|
||||||
return true;
|
soil.degrade(world, x, y - 1, z, EnumSoilType.SOIL);
|
||||||
}
|
}
|
||||||
|
} else if (type == Type.DecayingFlower && !soil.fertilise(world, x, y - 1, z, EnumSoilType.LOAM)) {
|
||||||
|
soil.fertilise(world, x, y - 1, z, EnumSoilType.FLOWERBED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public enum Type {
|
@Override
|
||||||
Weeds("weeds"),
|
public boolean isReplaceable(IBlockAccess world, int x, int y, int z) {
|
||||||
WeedsLong("longWeeds"),
|
return true;
|
||||||
WeedsVeryLong("veryLongWeeds"),
|
}
|
||||||
DeadFlower("deadFlower"),
|
|
||||||
DecayingFlower("decayingFlower");
|
|
||||||
|
|
||||||
public IIcon icon;
|
public enum Type {
|
||||||
|
|
||||||
protected String name;
|
Weeds("weeds"),
|
||||||
|
WeedsLong("longWeeds"),
|
||||||
|
WeedsVeryLong("veryLongWeeds"),
|
||||||
|
DeadFlower("deadFlower"),
|
||||||
|
DecayingFlower("decayingFlower");
|
||||||
|
|
||||||
Type(String name) {
|
public IIcon icon;
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Type get(int id) {
|
protected String name;
|
||||||
return values()[id % values().length];
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack get() {
|
Type(String name) {
|
||||||
return new ItemStack(Botany.plant, 1, ordinal());
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public static Type get(int id) {
|
||||||
return I18N.localise("botany.plant." + name);
|
return values()[id % values().length];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public ItemStack get() {
|
||||||
|
return new ItemStack(Botany.plant, 1, ordinal());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return I18N.localise("botany.plant." + name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,8 @@
|
|||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import java.util.List;
|
||||||
import binnie.botany.CreativeTabBotany;
|
import java.util.Random;
|
||||||
import binnie.botany.api.EnumAcidity;
|
|
||||||
import binnie.botany.api.EnumMoisture;
|
|
||||||
import binnie.botany.api.EnumSoilType;
|
|
||||||
import binnie.botany.api.gardening.IBlockSoil;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -22,193 +17,201 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.common.IPlantable;
|
import net.minecraftforge.common.IPlantable;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.List;
|
import binnie.botany.Botany;
|
||||||
import java.util.Random;
|
import binnie.botany.CreativeTabBotany;
|
||||||
|
import binnie.botany.api.EnumAcidity;
|
||||||
|
import binnie.botany.api.EnumMoisture;
|
||||||
|
import binnie.botany.api.EnumSoilType;
|
||||||
|
import binnie.botany.api.gardening.IBlockSoil;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockSoil extends Block implements IBlockSoil {
|
public class BlockSoil extends Block implements IBlockSoil {
|
||||||
protected boolean weedKilled;
|
|
||||||
protected IIcon[] iconsTop;
|
|
||||||
protected IIcon[] iconsSide;
|
|
||||||
protected IIcon[] iconsNoWeed;
|
|
||||||
protected EnumSoilType type;
|
|
||||||
|
|
||||||
public BlockSoil(EnumSoilType type, String blockName, boolean weedKilled) {
|
protected boolean weedKilled;
|
||||||
super(Material.ground);
|
protected IIcon[] iconsTop;
|
||||||
this.type = type;
|
protected IIcon[] iconsSide;
|
||||||
this.weedKilled = weedKilled;
|
protected IIcon[] iconsNoWeed;
|
||||||
iconsTop = new IIcon[9];
|
protected EnumSoilType type;
|
||||||
iconsSide = new IIcon[9];
|
|
||||||
iconsNoWeed = new IIcon[9];
|
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
setBlockName(blockName);
|
|
||||||
setTickRandomly(true);
|
|
||||||
setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.9375f, 1.0f);
|
|
||||||
setLightOpacity(255);
|
|
||||||
setHardness(0.5f);
|
|
||||||
setStepSound(Block.soundTypeGravel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getMeta(EnumAcidity acid, EnumMoisture moisture) {
|
public BlockSoil(EnumSoilType type, String blockName, boolean weedKilled) {
|
||||||
return acid.ordinal() * 3 + moisture.ordinal();
|
super(Material.ground);
|
||||||
}
|
this.type = type;
|
||||||
|
this.weedKilled = weedKilled;
|
||||||
|
iconsTop = new IIcon[9];
|
||||||
|
iconsSide = new IIcon[9];
|
||||||
|
iconsNoWeed = new IIcon[9];
|
||||||
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
setBlockName(blockName);
|
||||||
|
setTickRandomly(true);
|
||||||
|
setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.9375f, 1.0f);
|
||||||
|
setLightOpacity(255);
|
||||||
|
setHardness(0.5f);
|
||||||
|
setStepSound(Block.soundTypeGravel);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
public static int getMeta(EnumAcidity acid, EnumMoisture moisture) {
|
||||||
@SideOnly(Side.CLIENT)
|
return acid.ordinal() * 3 + moisture.ordinal();
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
}
|
||||||
for (int i = 0; i < 9; ++i) {
|
|
||||||
list.add(new ItemStack(this, 1, i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
for (int i = 0; i < 9; ++i) {
|
||||||
}
|
list.add(new ItemStack(this, 1, i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int meta) {
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
meta = ((meta >= 9) ? 8 : meta);
|
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||||
if (side == 1) {
|
}
|
||||||
return weedKilled ? iconsNoWeed[meta] : iconsTop[meta];
|
|
||||||
}
|
|
||||||
return (side == 0) ? Blocks.dirt.getIcon(side, 0) : iconsSide[meta];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public IIcon getIcon(int side, int meta) {
|
||||||
for (EnumMoisture moisture : EnumMoisture.values()) {
|
meta = ((meta >= 9) ? 8 : meta);
|
||||||
for (EnumAcidity pH : EnumAcidity.values()) {
|
if (side == 1) {
|
||||||
int index = moisture.ordinal() + pH.ordinal() * 3;
|
return weedKilled ? iconsNoWeed[meta] : iconsTop[meta];
|
||||||
String id = "soil/" + getType().getID() + "." + pH.getID() + "." + moisture.getID();
|
}
|
||||||
iconsTop[index] = Botany.proxy.getIcon(register, id + ".0");
|
return (side == 0) ? Blocks.dirt.getIcon(side, 0) : iconsSide[meta];
|
||||||
iconsSide[index] = Botany.proxy.getIcon(register, id + ".1");
|
}
|
||||||
iconsNoWeed[index] = Botany.proxy.getIcon(register, id + ".2");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public EnumSoilType getType() {
|
@Override
|
||||||
return type;
|
@SideOnly(Side.CLIENT)
|
||||||
}
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
|
for (EnumMoisture moisture : EnumMoisture.values()) {
|
||||||
|
for (EnumAcidity pH : EnumAcidity.values()) {
|
||||||
|
int index = moisture.ordinal() + pH.ordinal() * 3;
|
||||||
|
String id = "soil/" + getType().getID() + "." + pH.getID() + "." + moisture.getID();
|
||||||
|
iconsTop[index] = Botany.proxy.getIcon(register, id + ".0");
|
||||||
|
iconsSide[index] = Botany.proxy.getIcon(register, id + ".1");
|
||||||
|
iconsNoWeed[index] = Botany.proxy.getIcon(register, id + ".2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
public EnumSoilType getType() {
|
||||||
public int damageDropped(int damage) {
|
return type;
|
||||||
return damage;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
public int damageDropped(int damage) {
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
return damage;
|
||||||
EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
}
|
||||||
EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
|
||||||
EnumMoisture desiredMoisture = Gardening.getNaturalMoisture(world, x, y, z);
|
|
||||||
if (desiredMoisture.ordinal() > moisture.ordinal()) {
|
|
||||||
moisture = ((moisture == EnumMoisture.DRY) ? EnumMoisture.NORMAL : EnumMoisture.DAMP);
|
|
||||||
}
|
|
||||||
if (desiredMoisture.ordinal() < moisture.ordinal()) {
|
|
||||||
moisture = ((moisture == EnumMoisture.DAMP) ? EnumMoisture.NORMAL : EnumMoisture.DRY);
|
|
||||||
}
|
|
||||||
|
|
||||||
int meta2 = getMeta(acidity, moisture);
|
@Override
|
||||||
if (meta != meta2) {
|
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||||
world.setBlockMetadataWithNotify(x, y, z, meta2, 2);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
}
|
EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
||||||
if (!weedKilled && random.nextInt(5 - getType(world, x, y, z).ordinal()) == 0 && world.getBlock(x, y + 1, z) == Blocks.air) {
|
EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
||||||
world.setBlock(x, y + 1, z, Botany.plant, BlockPlant.Type.Weeds.ordinal(), 2);
|
EnumMoisture desiredMoisture = Gardening.getNaturalMoisture(world, x, y, z);
|
||||||
}
|
if (desiredMoisture.ordinal() > moisture.ordinal()) {
|
||||||
}
|
moisture = ((moisture == EnumMoisture.DRY) ? EnumMoisture.NORMAL : EnumMoisture.DAMP);
|
||||||
|
}
|
||||||
|
if (desiredMoisture.ordinal() < moisture.ordinal()) {
|
||||||
|
moisture = ((moisture == EnumMoisture.DAMP) ? EnumMoisture.NORMAL : EnumMoisture.DRY);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
int meta2 = getMeta(acidity, moisture);
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
if (meta != meta2) {
|
||||||
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
|
world.setBlockMetadataWithNotify(x, y, z, meta2, 2);
|
||||||
}
|
}
|
||||||
|
if (!weedKilled && random.nextInt(5 - getType(world, x, y, z).ordinal()) == 0
|
||||||
|
&& world.getBlock(x, y + 1, z) == Blocks.air) {
|
||||||
|
world.setBlock(x, y + 1, z, Botany.plant, BlockPlant.Type.Weeds.ordinal(), 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||||
return false;
|
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumAcidity getPH(World world, int x, int y, int z) {
|
public boolean renderAsNormalBlock() {
|
||||||
return EnumAcidity.values()[world.getBlockMetadata(x, y, z) / 3];
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumMoisture getMoisture(World world, int x, int y, int z) {
|
public EnumAcidity getPH(World world, int x, int y, int z) {
|
||||||
return EnumMoisture.values()[world.getBlockMetadata(x, y, z) % 3];
|
return EnumAcidity.values()[world.getBlockMetadata(x, y, z) / 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumSoilType getType(World world, int x, int y, int z) {
|
public EnumMoisture getMoisture(World world, int x, int y, int z) {
|
||||||
return type;
|
return EnumMoisture.values()[world.getBlockMetadata(x, y, z) % 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean fertilise(World world, int x, int y, int z, EnumSoilType maxLevel) {
|
public EnumSoilType getType(World world, int x, int y, int z) {
|
||||||
EnumSoilType type = getType(world, x, y, z);
|
return type;
|
||||||
if (type.ordinal() >= maxLevel.ordinal()) {
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
@Override
|
||||||
return world.setBlock(x, y, z, Gardening.getSoilBlock(maxLevel, weedKilled), meta, 2);
|
public boolean fertilise(World world, int x, int y, int z, EnumSoilType maxLevel) {
|
||||||
}
|
EnumSoilType type = getType(world, x, y, z);
|
||||||
|
if (type.ordinal() >= maxLevel.ordinal()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
public boolean degrade(World world, int x, int y, int z, EnumSoilType minLevel) {
|
return world.setBlock(x, y, z, Gardening.getSoilBlock(maxLevel, weedKilled), meta, 2);
|
||||||
EnumSoilType type = getType(world, x, y, z);
|
}
|
||||||
if (type.ordinal() <= minLevel.ordinal()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
@Override
|
||||||
return world.setBlock(x, y, z, Gardening.getSoilBlock(minLevel, weedKilled), meta, 2);
|
public boolean degrade(World world, int x, int y, int z, EnumSoilType minLevel) {
|
||||||
}
|
EnumSoilType type = getType(world, x, y, z);
|
||||||
|
if (type.ordinal() <= minLevel.ordinal()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
public boolean setPH(World world, int x, int y, int z, EnumAcidity pH) {
|
return world.setBlock(x, y, z, Gardening.getSoilBlock(minLevel, weedKilled), meta, 2);
|
||||||
int meta = getMeta(pH, getMoisture(world, x, y, z));
|
}
|
||||||
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setMoisture(World world, int x, int y, int z, EnumMoisture moisture) {
|
public boolean setPH(World world, int x, int y, int z, EnumAcidity pH) {
|
||||||
int meta = getMeta(getPH(world, x, y, z), moisture);
|
int meta = getMeta(pH, getMoisture(world, x, y, z));
|
||||||
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
public boolean setMoisture(World world, int x, int y, int z, EnumMoisture moisture) {
|
||||||
super.onNeighborBlockChange(world, x, y, z, block);
|
int meta = getMeta(getPH(world, x, y, z), moisture);
|
||||||
if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN, false)) {
|
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||||
world.setBlock(x, y, z, Blocks.dirt, 0, 2);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||||
Block plant = plantable.getPlant(world, x, y + 1, z);
|
super.onNeighborBlockChange(world, x, y, z, block);
|
||||||
if (plant == Botany.flower) {
|
if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN, false)) {
|
||||||
return true;
|
world.setBlock(x, y, z, Blocks.dirt, 0, 2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (plant == Botany.plant) {
|
@Override
|
||||||
return !weedKilled || !BlockPlant.isWeed(world, x, y, z);
|
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction,
|
||||||
}
|
IPlantable plantable) {
|
||||||
return world instanceof World
|
Block plant = plantable.getPlant(world, x, y + 1, z);
|
||||||
&& Blocks.dirt.canSustainPlant(world, x, y, z, direction, plantable);
|
if (plant == Botany.flower) {
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
if (plant == Botany.plant) {
|
||||||
public boolean resistsWeeds(World world, int x, int y, int z) {
|
return !weedKilled || !BlockPlant.isWeed(world, x, y, z);
|
||||||
return weedKilled;
|
}
|
||||||
}
|
return world instanceof World && Blocks.dirt.canSustainPlant(world, x, y, z, direction, plantable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean resistsWeeds(World world, int x, int y, int z) {
|
||||||
|
return weedKilled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,20 @@
|
|||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.EnumAcidity;
|
||||||
import binnie.botany.api.EnumMoisture;
|
import binnie.botany.api.EnumMoisture;
|
||||||
@@ -9,266 +24,262 @@ import binnie.botany.api.gardening.IBlockSoil;
|
|||||||
import binnie.botany.flower.TileEntityFlower;
|
import binnie.botany.flower.TileEntityFlower;
|
||||||
import binnie.botany.items.BotanyItems;
|
import binnie.botany.items.BotanyItems;
|
||||||
import binnie.core.BinnieCore;
|
import binnie.core.BinnieCore;
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
import forestry.api.core.EnumTemperature;
|
import forestry.api.core.EnumTemperature;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemBlock;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class Gardening {
|
public class Gardening {
|
||||||
public static Map<ItemStack, Integer> fertiliserAcid = new LinkedHashMap<>();
|
|
||||||
public static Map<ItemStack, Integer> fertiliserAlkaline = new LinkedHashMap<>();
|
|
||||||
public static Map<ItemStack, Integer> fertiliserNutrient = new LinkedHashMap<>();
|
|
||||||
|
|
||||||
public static boolean isSoil(Block block) {
|
public static Map<ItemStack, Integer> fertiliserAcid = new LinkedHashMap<>();
|
||||||
return block instanceof IBlockSoil;
|
public static Map<ItemStack, Integer> fertiliserAlkaline = new LinkedHashMap<>();
|
||||||
}
|
public static Map<ItemStack, Integer> fertiliserNutrient = new LinkedHashMap<>();
|
||||||
|
|
||||||
public static boolean isSoil(Item item) {
|
public static boolean isSoil(Block block) {
|
||||||
return item instanceof ItemBlock
|
return block instanceof IBlockSoil;
|
||||||
&& isSoil(((ItemBlock) item).field_150939_a);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static EnumMoisture getNaturalMoisture(World world, int x, int y, int z) {
|
public static boolean isSoil(Item item) {
|
||||||
float bias = getBiomeMoisture(world.getBiomeGenForCoords(x, z), y);
|
return item instanceof ItemBlock && isSoil(((ItemBlock) item).field_150939_a);
|
||||||
for (int dx = -1; dx < 2; ++dx) {
|
}
|
||||||
for (int dz = -1; dz < 2; ++dz) {
|
|
||||||
if (dx != 0 || dz != 0) {
|
|
||||||
if (world.getBlock(x + dx, y, z + dz) == Blocks.sand) {
|
|
||||||
bias -= 1.5;
|
|
||||||
} else if (world.getBlock(x + dx, y, z + dz) == Blocks.water) {
|
|
||||||
bias += 1.5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (world.isRaining() && world.canBlockSeeTheSky(x, y + 1, z) && world.getPrecipitationHeight(x, z) <= y + 1) {
|
public static EnumMoisture getNaturalMoisture(World world, int x, int y, int z) {
|
||||||
bias += 1.5;
|
float bias = getBiomeMoisture(world.getBiomeGenForCoords(x, z), y);
|
||||||
}
|
for (int dx = -1; dx < 2; ++dx) {
|
||||||
|
for (int dz = -1; dz < 2; ++dz) {
|
||||||
|
if (dx != 0 || dz != 0) {
|
||||||
|
if (world.getBlock(x + dx, y, z + dz) == Blocks.sand) {
|
||||||
|
bias -= 1.5;
|
||||||
|
} else if (world.getBlock(x + dx, y, z + dz) == Blocks.water) {
|
||||||
|
bias += 1.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int dx = -1; dx < 2; ++dx) {
|
if (world.isRaining() && world.canBlockSeeTheSky(x, y + 1, z) && world.getPrecipitationHeight(x, z) <= y + 1) {
|
||||||
for (int dz = -1; dz < 2; ++dz) {
|
bias += 1.5;
|
||||||
if (dx != 0 || dz != 0) {
|
}
|
||||||
if (world.getBlock(x + dx, y, z + dz) == Blocks.gravel && bias > 0.0f) {
|
|
||||||
bias *= 0.4f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bias <= -1.0f) {
|
for (int dx = -1; dx < 2; ++dx) {
|
||||||
return EnumMoisture.DRY;
|
for (int dz = -1; dz < 2; ++dz) {
|
||||||
}
|
if (dx != 0 || dz != 0) {
|
||||||
return (bias >= 1.0f) ? EnumMoisture.DAMP : EnumMoisture.NORMAL;
|
if (world.getBlock(x + dx, y, z + dz) == Blocks.gravel && bias > 0.0f) {
|
||||||
}
|
bias *= 0.4f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static EnumAcidity getNaturalPH(World world, int x, int y, int z) {
|
if (bias <= -1.0f) {
|
||||||
float bias = getBiomePH(world.getBiomeGenForCoords(x, z), y);
|
return EnumMoisture.DRY;
|
||||||
if (bias <= -1.0f) {
|
}
|
||||||
return EnumAcidity.ACID;
|
return (bias >= 1.0f) ? EnumMoisture.DAMP : EnumMoisture.NORMAL;
|
||||||
}
|
}
|
||||||
return (bias >= 1.0f) ? EnumAcidity.ALKALINE : EnumAcidity.NEUTRAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getBiomeMoisture(BiomeGenBase biome, int H) {
|
public static EnumAcidity getNaturalPH(World world, int x, int y, int z) {
|
||||||
double R = biome.rainfall;
|
float bias = getBiomePH(world.getBiomeGenForCoords(x, z), y);
|
||||||
double T = biome.temperature;
|
if (bias <= -1.0f) {
|
||||||
double m = 3.2 * (R - 0.5) - 0.4 * (1.0 + T + 0.5 * T * T) + 1.1 - 1.6 * (T - 0.9) * (T - 0.9) - 0.002 * (H - 64);
|
return EnumAcidity.ACID;
|
||||||
if (m == 0.0) {
|
}
|
||||||
return (float) m;
|
return (bias >= 1.0f) ? EnumAcidity.ALKALINE : EnumAcidity.NEUTRAL;
|
||||||
}
|
}
|
||||||
if (m < 0.0){
|
|
||||||
return (float) -Math.sqrt(m * m);
|
|
||||||
}
|
|
||||||
return (float) Math.sqrt(m * m);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getBiomePH(BiomeGenBase biome, int H) {
|
public static float getBiomeMoisture(BiomeGenBase biome, int H) {
|
||||||
double R = biome.rainfall;
|
double R = biome.rainfall;
|
||||||
double T = biome.temperature;
|
double T = biome.temperature;
|
||||||
return (float) (-3.0 * (R - 0.5) + 0.5 * (T - 0.699999988079071) * (T - 0.699999988079071) + 0.02f * (H - 64) - 0.15000000596046448);
|
double m = 3.2 * (R - 0.5) - 0.4 * (1.0 + T + 0.5 * T * T)
|
||||||
}
|
+ 1.1
|
||||||
|
- 1.6 * (T - 0.9) * (T - 0.9)
|
||||||
|
- 0.002 * (H - 64);
|
||||||
|
if (m == 0.0) {
|
||||||
|
return (float) m;
|
||||||
|
}
|
||||||
|
if (m < 0.0) {
|
||||||
|
return (float) -Math.sqrt(m * m);
|
||||||
|
}
|
||||||
|
return (float) Math.sqrt(m * m);
|
||||||
|
}
|
||||||
|
|
||||||
public static void createSoil(World world, int x, int y, int z, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity) {
|
public static float getBiomePH(BiomeGenBase biome, int H) {
|
||||||
int meta = moisture.ordinal() + acidity.ordinal() * 3;
|
double R = biome.rainfall;
|
||||||
world.setBlock(x, y, z, getSoilBlock(soil), meta, 2);
|
double T = biome.temperature;
|
||||||
}
|
return (float) (-3.0 * (R - 0.5) + 0.5 * (T - 0.699999988079071) * (T - 0.699999988079071)
|
||||||
|
+ 0.02f * (H - 64)
|
||||||
|
- 0.15000000596046448);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean plant(World world, int x, int y, int z, IFlower flower, GameProfile owner) {
|
public static void createSoil(World world, int x, int y, int z, EnumSoilType soil, EnumMoisture moisture,
|
||||||
boolean set = world.setBlock(x, y, z, Botany.flower, 0, 2);
|
EnumAcidity acidity) {
|
||||||
if (!set) {
|
int meta = moisture.ordinal() + acidity.ordinal() * 3;
|
||||||
return false;
|
world.setBlock(x, y, z, getSoilBlock(soil), meta, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntity tileFlower = world.getTileEntity(x, y, z);
|
public static boolean plant(World world, int x, int y, int z, IFlower flower, GameProfile owner) {
|
||||||
TileEntity below = world.getTileEntity(x, y - 1, z);
|
boolean set = world.setBlock(x, y, z, Botany.flower, 0, 2);
|
||||||
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
if (!set) {
|
||||||
if (below instanceof TileEntityFlower) {
|
return false;
|
||||||
((TileEntityFlower) tileFlower).setSection(((TileEntityFlower) below).getSection());
|
}
|
||||||
} else {
|
|
||||||
((TileEntityFlower) tileFlower).create(flower, owner);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tryGrowSection(world, x, y, z);
|
TileEntity tileFlower = world.getTileEntity(x, y, z);
|
||||||
return true;
|
TileEntity below = world.getTileEntity(x, y - 1, z);
|
||||||
}
|
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
||||||
|
if (below instanceof TileEntityFlower) {
|
||||||
|
((TileEntityFlower) tileFlower).setSection(((TileEntityFlower) below).getSection());
|
||||||
|
} else {
|
||||||
|
((TileEntityFlower) tileFlower).create(flower, owner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void tryGrowSection(World world, int x, int y, int z) {
|
tryGrowSection(world, x, y, z);
|
||||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
return true;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TileEntity flower = world.getTileEntity(x, y, z);
|
public static void tryGrowSection(World world, int x, int y, int z) {
|
||||||
if (flower == null || !(flower instanceof TileEntityFlower)) {
|
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFlower iflower = ((TileEntityFlower) flower).getFlower();
|
TileEntity flower = world.getTileEntity(x, y, z);
|
||||||
int section = ((TileEntityFlower) flower).getSection();
|
if (flower == null || !(flower instanceof TileEntityFlower)) {
|
||||||
if (iflower == null || section >= iflower.getGenome().getPrimary().getType().getSections() - 1 || iflower.getAge() <= 0) {
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
world.setBlock(x, y + 1, z, Botany.flower, 0, 2);
|
IFlower iflower = ((TileEntityFlower) flower).getFlower();
|
||||||
TileEntity tileFlower = world.getTileEntity(x, y + 1, z);
|
int section = ((TileEntityFlower) flower).getSection();
|
||||||
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
if (iflower == null || section >= iflower.getGenome().getPrimary().getType().getSections() - 1
|
||||||
((TileEntityFlower) tileFlower).setSection(section + 1);
|
|| iflower.getAge() <= 0) {
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onGrowFromSeed(World world, int x, int y, int z) {
|
world.setBlock(x, y + 1, z, Botany.flower, 0, 2);
|
||||||
tryGrowSection(world, x, y, z);
|
TileEntity tileFlower = world.getTileEntity(x, y + 1, z);
|
||||||
}
|
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
||||||
|
((TileEntityFlower) tileFlower).setSection(section + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Collection<ItemStack> getAcidFertilisers() {
|
public static void onGrowFromSeed(World world, int x, int y, int z) {
|
||||||
return Gardening.fertiliserAcid.keySet();
|
tryGrowSection(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Collection<ItemStack> getAlkalineFertilisers() {
|
public static Collection<ItemStack> getAcidFertilisers() {
|
||||||
return Gardening.fertiliserAlkaline.keySet();
|
return Gardening.fertiliserAcid.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Collection<ItemStack> getNutrientFertilisers() {
|
public static Collection<ItemStack> getAlkalineFertilisers() {
|
||||||
return Gardening.fertiliserNutrient.keySet();
|
return Gardening.fertiliserAlkaline.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAcidFertiliser(ItemStack itemstack) {
|
public static Collection<ItemStack> getNutrientFertilisers() {
|
||||||
for (ItemStack stack : getAcidFertilisers()) {
|
return Gardening.fertiliserNutrient.keySet();
|
||||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isAlkalineFertiliser(ItemStack itemstack) {
|
public static boolean isAcidFertiliser(ItemStack itemstack) {
|
||||||
for (ItemStack stack : getAlkalineFertilisers()) {
|
for (ItemStack stack : getAcidFertilisers()) {
|
||||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNutrientFertiliser(ItemStack itemstack) {
|
public static boolean isAlkalineFertiliser(ItemStack itemstack) {
|
||||||
for (ItemStack stack : getNutrientFertilisers()) {
|
for (ItemStack stack : getAlkalineFertilisers()) {
|
||||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getFertiliserStrength(ItemStack stack) {
|
public static boolean isNutrientFertiliser(ItemStack itemstack) {
|
||||||
if (stack == null) {
|
for (ItemStack stack : getNutrientFertilisers()) {
|
||||||
return 1;
|
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAcid.entrySet()) {
|
public static int getFertiliserStrength(ItemStack stack) {
|
||||||
if (entry.getKey().isItemEqual(stack)) {
|
if (stack == null) {
|
||||||
return entry.getValue();
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAlkaline.entrySet()) {
|
for (Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAcid.entrySet()) {
|
||||||
if (entry.getKey().isItemEqual(stack)) {
|
if (entry.getKey().isItemEqual(stack)) {
|
||||||
return entry.getValue();
|
return entry.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserNutrient.entrySet()) {
|
for (Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAlkaline.entrySet()) {
|
||||||
if (entry.getKey().isItemEqual(stack)) {
|
if (entry.getKey().isItemEqual(stack)) {
|
||||||
return entry.getValue();
|
return entry.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean canTolerate(IFlower flower, World world, int x, int y, int z) {
|
for (Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserNutrient.entrySet()) {
|
||||||
if (flower == null || flower.getGenome() == null) {
|
if (entry.getKey().isItemEqual(stack)) {
|
||||||
return false;
|
return entry.getValue();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int soilMeta = world.getBlockMetadata(x, y - 1, z);
|
public static boolean canTolerate(IFlower flower, World world, int x, int y, int z) {
|
||||||
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
|
if (flower == null || flower.getGenome() == null) {
|
||||||
return canTolerate(flower, EnumAcidity.values()[soilMeta / 3 % 3], EnumMoisture.values()[soilMeta % 3], EnumTemperature.getFromValue(biome.temperature));
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnumSoilType getSoilType(World world, int x, int y, int z) {
|
int soilMeta = world.getBlockMetadata(x, y - 1, z);
|
||||||
if (world.getBlock(x, y, z) instanceof IBlockSoil) {
|
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
|
||||||
return ((IBlockSoil) world.getBlock(x, y, z)).getType(world, x, y, z);
|
return canTolerate(
|
||||||
}
|
flower,
|
||||||
return EnumSoilType.SOIL;
|
EnumAcidity.values()[soilMeta / 3 % 3],
|
||||||
}
|
EnumMoisture.values()[soilMeta % 3],
|
||||||
|
EnumTemperature.getFromValue(biome.temperature));
|
||||||
|
}
|
||||||
|
|
||||||
public static Block getSoilBlock(EnumSoilType type) {
|
public static EnumSoilType getSoilType(World world, int x, int y, int z) {
|
||||||
return getSoilBlock(type, false);
|
if (world.getBlock(x, y, z) instanceof IBlockSoil) {
|
||||||
}
|
return ((IBlockSoil) world.getBlock(x, y, z)).getType(world, x, y, z);
|
||||||
|
}
|
||||||
|
return EnumSoilType.SOIL;
|
||||||
|
}
|
||||||
|
|
||||||
public static Block getSoilBlock(EnumSoilType type, boolean weedkill) {
|
public static Block getSoilBlock(EnumSoilType type) {
|
||||||
switch (type) {
|
return getSoilBlock(type, false);
|
||||||
case FLOWERBED:
|
}
|
||||||
return weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
|
|
||||||
|
|
||||||
case LOAM:
|
public static Block getSoilBlock(EnumSoilType type, boolean weedkill) {
|
||||||
return weedkill ? Botany.loamNoWeed : Botany.loam;
|
switch (type) {
|
||||||
}
|
case FLOWERBED:
|
||||||
return weedkill ? Botany.soilNoWeed : Botany.soil;
|
return weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean canTolerate(IFlower flower, EnumAcidity ePH, EnumMoisture eMoisture, EnumTemperature eTemp) {
|
case LOAM:
|
||||||
return flower.getGenome().canTolerate(ePH)
|
return weedkill ? Botany.loamNoWeed : Botany.loam;
|
||||||
&& flower.getGenome().canTolerate(eMoisture)
|
}
|
||||||
&& flower.getGenome().canTolerate(eTemp);
|
return weedkill ? Botany.soilNoWeed : Botany.soil;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isWeedkiller(ItemStack heldItem) {
|
public static boolean canTolerate(IFlower flower, EnumAcidity ePH, EnumMoisture eMoisture, EnumTemperature eTemp) {
|
||||||
return heldItem != null
|
return flower.getGenome().canTolerate(ePH) && flower.getGenome().canTolerate(eMoisture)
|
||||||
&& heldItem.isItemEqual(BotanyItems.Weedkiller.get(1));
|
&& flower.getGenome().canTolerate(eTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean addWeedKiller(World world, int x, int y, int z) {
|
public static boolean isWeedkiller(ItemStack heldItem) {
|
||||||
if (!(world.getBlock(x, y, z) instanceof IBlockSoil)) {
|
return heldItem != null && heldItem.isItemEqual(BotanyItems.Weedkiller.get(1));
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
EnumSoilType type = getSoilType(world, x, y, z);
|
public static boolean addWeedKiller(World world, int x, int y, int z) {
|
||||||
Block block = getSoilBlock(type, true);
|
if (!(world.getBlock(x, y, z) instanceof IBlockSoil)) {
|
||||||
boolean done = world.setBlock(x, y, z, block, world.getBlockMetadata(x, y, z), 2);
|
return false;
|
||||||
if (done && BlockPlant.isWeed(world, x, y + 1, z)) {
|
}
|
||||||
world.setBlockToAir(x, y + 1, z);
|
|
||||||
}
|
EnumSoilType type = getSoilType(world, x, y, z);
|
||||||
return done;
|
Block block = getSoilBlock(type, true);
|
||||||
}
|
boolean done = world.setBlock(x, y, z, block, world.getBlockMetadata(x, y, z), 2);
|
||||||
|
if (done && BlockPlant.isWeed(world, x, y + 1, z)) {
|
||||||
|
world.setBlockToAir(x, y + 1, z);
|
||||||
|
}
|
||||||
|
return done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,86 +1,80 @@
|
|||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.EnumAcidity;
|
||||||
import binnie.botany.api.EnumMoisture;
|
import binnie.botany.api.EnumMoisture;
|
||||||
import binnie.botany.api.EnumSoilType;
|
import binnie.botany.api.EnumSoilType;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemBlock;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class ItemSoil extends ItemBlock {
|
public class ItemSoil extends ItemBlock {
|
||||||
protected EnumSoilType type;
|
|
||||||
|
|
||||||
private boolean noWeed;
|
protected EnumSoilType type;
|
||||||
|
|
||||||
public ItemSoil(Block block) {
|
private boolean noWeed;
|
||||||
super(block);
|
|
||||||
type = ((BlockSoil) field_150939_a).getType();
|
|
||||||
noWeed = ((BlockSoil) field_150939_a).weedKilled;
|
|
||||||
hasSubtypes = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ItemSoil(Block block) {
|
||||||
@SideOnly(Side.CLIENT)
|
super(block);
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
type = ((BlockSoil) field_150939_a).getType();
|
||||||
super.addInformation(stack, player, tooltip, advanced);
|
noWeed = ((BlockSoil) field_150939_a).weedKilled;
|
||||||
EnumMoisture moisture = EnumMoisture.values()[stack.getItemDamage() % 3];
|
hasSubtypes = true;
|
||||||
EnumAcidity acidity = EnumAcidity.values()[stack.getItemDamage() / 3];
|
}
|
||||||
String info = "";
|
|
||||||
|
|
||||||
if (moisture == EnumMoisture.DRY) {
|
@Override
|
||||||
info += EnumChatFormatting.YELLOW
|
@SideOnly(Side.CLIENT)
|
||||||
+ I18N.localise("botany.moisture.dry")
|
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||||
+ EnumChatFormatting.RESET;
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
}
|
EnumMoisture moisture = EnumMoisture.values()[stack.getItemDamage() % 3];
|
||||||
if (moisture == EnumMoisture.DAMP) {
|
EnumAcidity acidity = EnumAcidity.values()[stack.getItemDamage() / 3];
|
||||||
info += EnumChatFormatting.YELLOW
|
String info = "";
|
||||||
+ I18N.localise("botany.moisture.damp")
|
|
||||||
+ EnumChatFormatting.RESET;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (acidity == EnumAcidity.ACID) {
|
if (moisture == EnumMoisture.DRY) {
|
||||||
if (info.length() > 0) {
|
info += EnumChatFormatting.YELLOW + I18N.localise("botany.moisture.dry") + EnumChatFormatting.RESET;
|
||||||
info += ", ";
|
}
|
||||||
}
|
if (moisture == EnumMoisture.DAMP) {
|
||||||
info += EnumChatFormatting.YELLOW
|
info += EnumChatFormatting.YELLOW + I18N.localise("botany.moisture.damp") + EnumChatFormatting.RESET;
|
||||||
+ I18N.localise("botany.ph.acid")
|
}
|
||||||
+ EnumChatFormatting.RESET;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (acidity == EnumAcidity.ALKALINE) {
|
if (acidity == EnumAcidity.ACID) {
|
||||||
if (info.length() > 0) {
|
if (info.length() > 0) {
|
||||||
info += ", ";
|
info += ", ";
|
||||||
}
|
}
|
||||||
info += EnumChatFormatting.YELLOW
|
info += EnumChatFormatting.YELLOW + I18N.localise("botany.ph.acid") + EnumChatFormatting.RESET;
|
||||||
+ I18N.localise("botany.ph.alkaline")
|
}
|
||||||
+ EnumChatFormatting.RESET;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info.length() > 0) {
|
if (acidity == EnumAcidity.ALKALINE) {
|
||||||
tooltip.add(info);
|
if (info.length() > 0) {
|
||||||
}
|
info += ", ";
|
||||||
|
}
|
||||||
|
info += EnumChatFormatting.YELLOW + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET;
|
||||||
|
}
|
||||||
|
|
||||||
if (noWeed) {
|
if (info.length() > 0) {
|
||||||
tooltip.add(I18N.localise("botany.soil.weedkiller"));
|
tooltip.add(info);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
if (noWeed) {
|
||||||
public String getItemStackDisplayName(ItemStack stack) {
|
tooltip.add(I18N.localise("botany.soil.weedkiller"));
|
||||||
String soilName = type.name().toLowerCase(Locale.ENGLISH);
|
}
|
||||||
return I18N.localise("botany.soil." + soilName);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetadata(int meta) {
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
return meta;
|
String soilName = type.name().toLowerCase(Locale.ENGLISH);
|
||||||
}
|
return I18N.localise("botany.soil." + soilName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetadata(int meta) {
|
||||||
|
return meta;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,15 @@
|
|||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ChatComponentText;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import binnie.botany.CreativeTabBotany;
|
import binnie.botany.CreativeTabBotany;
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.EnumAcidity;
|
||||||
@@ -11,74 +21,58 @@ import binnie.core.util.I18N;
|
|||||||
import binnie.genetics.genetics.AlleleHelper;
|
import binnie.genetics.genetics.AlleleHelper;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ChatComponentText;
|
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
|
||||||
import net.minecraft.util.IChatComponent;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class ItemSoilMeter extends Item {
|
public class ItemSoilMeter extends Item {
|
||||||
public ItemSoilMeter() {
|
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
setUnlocalizedName("soilMeter");
|
|
||||||
setMaxStackSize(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ItemSoilMeter() {
|
||||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float blockX, float blockY, float blockZ) {
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
Block block = world.getBlock(x, y, z);
|
setUnlocalizedName("soilMeter");
|
||||||
if (!Gardening.isSoil(block)) {
|
setMaxStackSize(1);
|
||||||
y--;
|
}
|
||||||
block = world.getBlock(x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Gardening.isSoil(block) && !BinnieCore.proxy.isSimulating(world)) {
|
@Override
|
||||||
IBlockSoil soil = (IBlockSoil) block;
|
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||||
EnumSoilType type = soil.getType(world, x, y, z);
|
float blockX, float blockY, float blockZ) {
|
||||||
EnumMoisture moisture = soil.getMoisture(world, x, y, z);
|
Block block = world.getBlock(x, y, z);
|
||||||
EnumAcidity pH = soil.getPH(world, x, y, z);
|
if (!Gardening.isSoil(block)) {
|
||||||
|
y--;
|
||||||
|
block = world.getBlock(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
EnumChatFormatting[] colors = new EnumChatFormatting[]{
|
if (Gardening.isSoil(block) && !BinnieCore.proxy.isSimulating(world)) {
|
||||||
EnumChatFormatting.DARK_GRAY,
|
IBlockSoil soil = (IBlockSoil) block;
|
||||||
EnumChatFormatting.GOLD,
|
EnumSoilType type = soil.getType(world, x, y, z);
|
||||||
EnumChatFormatting.LIGHT_PURPLE,
|
EnumMoisture moisture = soil.getMoisture(world, x, y, z);
|
||||||
};
|
EnumAcidity pH = soil.getPH(world, x, y, z);
|
||||||
String info = I18N.localise("botany.soil.tooltip.type") + " ";
|
|
||||||
info += colors[type.ordinal()] + AlleleHelper.toDisplay(type) + EnumChatFormatting.RESET;
|
|
||||||
|
|
||||||
colors = new EnumChatFormatting[]{
|
EnumChatFormatting[] colors = new EnumChatFormatting[] { EnumChatFormatting.DARK_GRAY,
|
||||||
EnumChatFormatting.YELLOW,
|
EnumChatFormatting.GOLD, EnumChatFormatting.LIGHT_PURPLE, };
|
||||||
EnumChatFormatting.GRAY,
|
String info = I18N.localise("botany.soil.tooltip.type") + " ";
|
||||||
EnumChatFormatting.BLUE,
|
info += colors[type.ordinal()] + AlleleHelper.toDisplay(type) + EnumChatFormatting.RESET;
|
||||||
};
|
|
||||||
info += ", " + I18N.localise("botany.soil.tooltip.moisture") + " ";
|
|
||||||
info += colors[moisture.ordinal()] + AlleleHelper.toDisplay(moisture) + EnumChatFormatting.RESET;
|
|
||||||
|
|
||||||
colors = new EnumChatFormatting[]{
|
colors = new EnumChatFormatting[] { EnumChatFormatting.YELLOW, EnumChatFormatting.GRAY,
|
||||||
EnumChatFormatting.RED,
|
EnumChatFormatting.BLUE, };
|
||||||
EnumChatFormatting.GREEN,
|
info += ", " + I18N.localise("botany.soil.tooltip.moisture") + " ";
|
||||||
EnumChatFormatting.AQUA,
|
info += colors[moisture.ordinal()] + AlleleHelper.toDisplay(moisture) + EnumChatFormatting.RESET;
|
||||||
};
|
|
||||||
info += ", " + I18N.localise("botany.soil.tooltip.pH") + " ";
|
|
||||||
info += colors[pH.ordinal()] + AlleleHelper.toDisplay(pH) + EnumChatFormatting.RESET;
|
|
||||||
IChatComponent chat = new ChatComponentText(info);
|
|
||||||
player.addChatMessage(chat);
|
|
||||||
}
|
|
||||||
return super.onItemUse(stack, player, world, x, y, z, side, blockX, blockY, blockZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
colors = new EnumChatFormatting[] { EnumChatFormatting.RED, EnumChatFormatting.GREEN,
|
||||||
@SideOnly(Side.CLIENT)
|
EnumChatFormatting.AQUA, };
|
||||||
public void registerIcons(IIconRegister register) {
|
info += ", " + I18N.localise("botany.soil.tooltip.pH") + " ";
|
||||||
itemIcon = Botany.proxy.getIcon(register, "soilMeter");
|
info += colors[pH.ordinal()] + AlleleHelper.toDisplay(pH) + EnumChatFormatting.RESET;
|
||||||
}
|
IChatComponent chat = new ChatComponentText(info);
|
||||||
|
player.addChatMessage(chat);
|
||||||
|
}
|
||||||
|
return super.onItemUse(stack, player, world, x, y, z, side, blockX, blockY, blockZ);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(ItemStack stack) {
|
@SideOnly(Side.CLIENT)
|
||||||
return I18N.localise("botany.item.soilMeter.name");
|
public void registerIcons(IIconRegister register) {
|
||||||
}
|
itemIcon = Botany.proxy.getIcon(register, "soilMeter");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
|
return I18N.localise("botany.item.soilMeter.name");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,5 @@
|
|||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import binnie.botany.api.EnumAcidity;
|
|
||||||
import binnie.botany.api.EnumMoisture;
|
|
||||||
import binnie.botany.api.EnumSoilType;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -15,53 +8,70 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.CreativeTabBotany;
|
||||||
|
import binnie.botany.api.EnumAcidity;
|
||||||
|
import binnie.botany.api.EnumMoisture;
|
||||||
|
import binnie.botany.api.EnumSoilType;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class ItemTrowel extends Item {
|
public class ItemTrowel extends Item {
|
||||||
protected Item.ToolMaterial theToolMaterial;
|
|
||||||
String locName;
|
|
||||||
|
|
||||||
public ItemTrowel(Item.ToolMaterial toolMaterial, String material) {
|
protected Item.ToolMaterial theToolMaterial;
|
||||||
theToolMaterial = toolMaterial;
|
String locName;
|
||||||
maxStackSize = 1;
|
|
||||||
setMaxDamage(toolMaterial.getMaxUses());
|
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
setUnlocalizedName("trowel" + material);
|
|
||||||
locName = "trowel" + material;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ItemTrowel(Item.ToolMaterial toolMaterial, String material) {
|
||||||
@SideOnly(Side.CLIENT)
|
theToolMaterial = toolMaterial;
|
||||||
public void registerIcons(IIconRegister register) {
|
maxStackSize = 1;
|
||||||
itemIcon = Botany.proxy.getIcon(register, "tools/" + locName);
|
setMaxDamage(toolMaterial.getMaxUses());
|
||||||
}
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
setUnlocalizedName("trowel" + material);
|
||||||
|
locName = "trowel" + material;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float blockX, float blockY, float blockZ) {
|
@SideOnly(Side.CLIENT)
|
||||||
if (!player.canPlayerEdit(x, y, z, side, stack)) {
|
public void registerIcons(IIconRegister register) {
|
||||||
return false;
|
itemIcon = Botany.proxy.getIcon(register, "tools/" + locName);
|
||||||
}
|
}
|
||||||
Block block = world.getBlock(x, y, z);
|
|
||||||
if (side == 0 ||
|
|
||||||
(!world.getBlock(x, y + 1, z).isAir(world, x, y + 1, z) && world.getBlock(x, y + 1, z) != Botany.flower) ||
|
|
||||||
(block != Blocks.grass && block != Blocks.dirt)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Block block2 = Botany.soil;
|
@Override
|
||||||
world.playSoundEffect(x + 0.5f, y + 0.5f, z + 0.5f, block2.stepSound.getStepResourcePath(), (block2.stepSound.getVolume() + 1.0f) / 2.0f, block2.stepSound.getPitch() * 0.8f);
|
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||||
if (world.isRemote) {
|
float blockX, float blockY, float blockZ) {
|
||||||
return true;
|
if (!player.canPlayerEdit(x, y, z, side, stack)) {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
Block block = world.getBlock(x, y, z);
|
||||||
|
if (side == 0
|
||||||
|
|| (!world.getBlock(x, y + 1, z).isAir(world, x, y + 1, z)
|
||||||
|
&& world.getBlock(x, y + 1, z) != Botany.flower)
|
||||||
|
|| (block != Blocks.grass && block != Blocks.dirt)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
EnumMoisture moisture = Gardening.getNaturalMoisture(world, x, y, z);
|
Block block2 = Botany.soil;
|
||||||
EnumAcidity acidity = Gardening.getNaturalPH(world, x, y, z);
|
world.playSoundEffect(
|
||||||
Gardening.createSoil(world, x, y, z, EnumSoilType.SOIL, moisture, acidity);
|
x + 0.5f,
|
||||||
stack.damageItem(1, player);
|
y + 0.5f,
|
||||||
return true;
|
z + 0.5f,
|
||||||
}
|
block2.stepSound.getStepResourcePath(),
|
||||||
|
(block2.stepSound.getVolume() + 1.0f) / 2.0f,
|
||||||
|
block2.stepSound.getPitch() * 0.8f);
|
||||||
|
if (world.isRemote) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
EnumMoisture moisture = Gardening.getNaturalMoisture(world, x, y, z);
|
||||||
@SideOnly(Side.CLIENT)
|
EnumAcidity acidity = Gardening.getNaturalPH(world, x, y, z);
|
||||||
public boolean isFull3D() {
|
Gardening.createSoil(world, x, y, z, EnumSoilType.SOIL, moisture, acidity);
|
||||||
return true;
|
stack.damageItem(1, player);
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public boolean isFull3D() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,32 +1,34 @@
|
|||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class ItemWeed extends ItemBlock {
|
public class ItemWeed extends ItemBlock {
|
||||||
public ItemWeed(Block block) {
|
|
||||||
super(block);
|
|
||||||
setHasSubtypes(true);
|
|
||||||
hasSubtypes = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ItemWeed(Block block) {
|
||||||
public String getItemStackDisplayName(ItemStack stack) {
|
super(block);
|
||||||
return BlockPlant.Type.values()[stack.getItemDamage()].getName();
|
setHasSubtypes(true);
|
||||||
}
|
hasSubtypes = true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetadata(int meta) {
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
return meta;
|
return BlockPlant.Type.values()[stack.getItemDamage()].getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public int getMetadata(int meta) {
|
||||||
public IIcon getIconFromDamage(int damage) {
|
return meta;
|
||||||
return field_150939_a.getIcon(2, damage);
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public IIcon getIconFromDamage(int damage) {
|
||||||
|
return field_150939_a.getIcon(2, damage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,17 @@
|
|||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
import net.minecraftforge.oredict.RecipeSorter;
|
||||||
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
|
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import binnie.botany.CreativeTabBotany;
|
import binnie.botany.CreativeTabBotany;
|
||||||
@@ -26,345 +38,333 @@ import binnie.core.block.ItemMetadataRenderer;
|
|||||||
import binnie.core.block.MultipassItemRenderer;
|
import binnie.core.block.MultipassItemRenderer;
|
||||||
import binnie.core.block.TileEntityMetadata;
|
import binnie.core.block.TileEntityMetadata;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
import net.minecraftforge.oredict.RecipeSorter;
|
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
|
||||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class ModuleGardening implements IInitializable {
|
public class ModuleGardening implements IInitializable {
|
||||||
public static HashMap<ItemStack, Integer> queuedAcidFertilisers = new HashMap<>();
|
|
||||||
public static HashMap<ItemStack, Integer> queuedAlkalineFertilisers = new HashMap<>();
|
|
||||||
public static HashMap<ItemStack, Integer> queuedNutrientFertilisers = new HashMap<>();
|
|
||||||
|
|
||||||
@Override
|
public static HashMap<ItemStack, Integer> queuedAcidFertilisers = new HashMap<>();
|
||||||
public void preInit() {
|
public static HashMap<ItemStack, Integer> queuedAlkalineFertilisers = new HashMap<>();
|
||||||
Botany.plant = new BlockPlant();
|
public static HashMap<ItemStack, Integer> queuedNutrientFertilisers = new HashMap<>();
|
||||||
GameRegistry.registerBlock(Botany.plant, ItemWeed.class, "plant");
|
|
||||||
|
|
||||||
Botany.soil = new BlockSoil(EnumSoilType.SOIL, "soil", false);
|
@Override
|
||||||
GameRegistry.registerBlock(Botany.soil, ItemSoil.class, "soil");
|
public void preInit() {
|
||||||
|
Botany.plant = new BlockPlant();
|
||||||
|
GameRegistry.registerBlock(Botany.plant, ItemWeed.class, "plant");
|
||||||
|
|
||||||
Botany.loam = new BlockSoil(EnumSoilType.LOAM, "loam", false);
|
Botany.soil = new BlockSoil(EnumSoilType.SOIL, "soil", false);
|
||||||
GameRegistry.registerBlock(Botany.loam, ItemSoil.class, "loam");
|
GameRegistry.registerBlock(Botany.soil, ItemSoil.class, "soil");
|
||||||
|
|
||||||
Botany.flowerbed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbed", false);
|
Botany.loam = new BlockSoil(EnumSoilType.LOAM, "loam", false);
|
||||||
GameRegistry.registerBlock(Botany.flowerbed, ItemSoil.class, "flowerbed");
|
GameRegistry.registerBlock(Botany.loam, ItemSoil.class, "loam");
|
||||||
|
|
||||||
Botany.soilNoWeed = new BlockSoil(EnumSoilType.SOIL, "soilNoWeed", true);
|
Botany.flowerbed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbed", false);
|
||||||
GameRegistry.registerBlock(Botany.soilNoWeed, ItemSoil.class, "soilNoWeed");
|
GameRegistry.registerBlock(Botany.flowerbed, ItemSoil.class, "flowerbed");
|
||||||
|
|
||||||
Botany.loamNoWeed = new BlockSoil(EnumSoilType.LOAM, "loamNoWeed", true);
|
Botany.soilNoWeed = new BlockSoil(EnumSoilType.SOIL, "soilNoWeed", true);
|
||||||
GameRegistry.registerBlock(Botany.loamNoWeed, ItemSoil.class, "loamNoWeed");
|
GameRegistry.registerBlock(Botany.soilNoWeed, ItemSoil.class, "soilNoWeed");
|
||||||
|
|
||||||
Botany.flowerbedNoWeed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbedNoWeed", true);
|
Botany.loamNoWeed = new BlockSoil(EnumSoilType.LOAM, "loamNoWeed", true);
|
||||||
GameRegistry.registerBlock(Botany.flowerbedNoWeed, ItemSoil.class, "flowerbedNoWeed");
|
GameRegistry.registerBlock(Botany.loamNoWeed, ItemSoil.class, "loamNoWeed");
|
||||||
|
|
||||||
Botany.soilMeter = new ItemSoilMeter();
|
Botany.flowerbedNoWeed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbedNoWeed", true);
|
||||||
Botany.insulatedTube = new ItemInsulatedTube();
|
GameRegistry.registerBlock(Botany.flowerbedNoWeed, ItemSoil.class, "flowerbedNoWeed");
|
||||||
Botany.trowelWood = new ItemTrowel(Item.ToolMaterial.WOOD, "Wood");
|
|
||||||
Botany.trowelStone = new ItemTrowel(Item.ToolMaterial.STONE, "Stone");
|
|
||||||
Botany.trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "Iron");
|
|
||||||
Botany.trowelDiamond = new ItemTrowel(Item.ToolMaterial.EMERALD, "Diamond");
|
|
||||||
Botany.trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "Gold");
|
|
||||||
Botany.misc = Binnie.Item.registerMiscItems(BotanyItems.values(), CreativeTabBotany.instance);
|
|
||||||
Botany.pigment = new ItemPigment();
|
|
||||||
Botany.clay = new ItemClay();
|
|
||||||
|
|
||||||
Botany.ceramic = new BlockCeramic();
|
Botany.soilMeter = new ItemSoilMeter();
|
||||||
GameRegistry.registerBlock(Botany.ceramic, ItemMetadata.class, "ceramic");
|
Botany.insulatedTube = new ItemInsulatedTube();
|
||||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramic), new ItemMetadataRenderer());
|
Botany.trowelWood = new ItemTrowel(Item.ToolMaterial.WOOD, "Wood");
|
||||||
|
Botany.trowelStone = new ItemTrowel(Item.ToolMaterial.STONE, "Stone");
|
||||||
|
Botany.trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "Iron");
|
||||||
|
Botany.trowelDiamond = new ItemTrowel(Item.ToolMaterial.EMERALD, "Diamond");
|
||||||
|
Botany.trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "Gold");
|
||||||
|
Botany.misc = Binnie.Item.registerMiscItems(BotanyItems.values(), CreativeTabBotany.instance);
|
||||||
|
Botany.pigment = new ItemPigment();
|
||||||
|
Botany.clay = new ItemClay();
|
||||||
|
|
||||||
Botany.stained = new BlockStained();
|
Botany.ceramic = new BlockCeramic();
|
||||||
GameRegistry.registerBlock(Botany.stained, ItemMetadata.class, "stained");
|
GameRegistry.registerBlock(Botany.ceramic, ItemMetadata.class, "ceramic");
|
||||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.stained), new ItemMetadataRenderer());
|
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramic), new ItemMetadataRenderer());
|
||||||
|
|
||||||
Botany.ceramicTile = new BlockCeramicPatterned();
|
Botany.stained = new BlockStained();
|
||||||
GameRegistry.registerBlock(Botany.ceramicTile, ItemMetadata.class, "ceramicPattern");
|
GameRegistry.registerBlock(Botany.stained, ItemMetadata.class, "stained");
|
||||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicTile), new MultipassItemRenderer());
|
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.stained), new ItemMetadataRenderer());
|
||||||
|
|
||||||
Botany.ceramicBrick = new BlockCeramicBrick();
|
Botany.ceramicTile = new BlockCeramicPatterned();
|
||||||
GameRegistry.registerBlock(Botany.ceramicBrick, ItemMetadata.class, "ceramicBrick");
|
GameRegistry.registerBlock(Botany.ceramicTile, ItemMetadata.class, "ceramicPattern");
|
||||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicBrick), new MultipassItemRenderer());
|
BinnieCore.proxy
|
||||||
}
|
.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicTile), new MultipassItemRenderer());
|
||||||
|
|
||||||
@Override
|
Botany.ceramicBrick = new BlockCeramicBrick();
|
||||||
public void init() {
|
GameRegistry.registerBlock(Botany.ceramicBrick, ItemMetadata.class, "ceramicBrick");
|
||||||
OreDictionary.registerOre("pigment", Botany.pigment);
|
BinnieCore.proxy
|
||||||
RecipeSorter.register("botany:ceramictile", CeramicTileRecipe.class, RecipeSorter.Category.SHAPED, "");
|
.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicBrick), new MultipassItemRenderer());
|
||||||
RecipeSorter.register("botany:pigment", PigmentRecipe.class, RecipeSorter.Category.SHAPED, "");
|
}
|
||||||
ItemStack yellow = new ItemStack(Blocks.yellow_flower, 1);
|
|
||||||
ItemStack red = new ItemStack(Blocks.red_flower, 1);
|
|
||||||
ItemStack blue = new ItemStack(Blocks.red_flower, 1, 7);
|
|
||||||
|
|
||||||
for (boolean manual : new boolean[]{true, false}) {
|
@Override
|
||||||
for (boolean fertilised : new boolean[]{true, false}) {
|
public void init() {
|
||||||
for (EnumMoisture moist : EnumMoisture.values()) {
|
OreDictionary.registerOre("pigment", Botany.pigment);
|
||||||
ItemStack icon = (moist == EnumMoisture.DRY) ? yellow : ((moist == EnumMoisture.NORMAL) ? red : blue);
|
RecipeSorter.register("botany:ceramictile", CeramicTileRecipe.class, RecipeSorter.Category.SHAPED, "");
|
||||||
int insulate = 2 - moist.ordinal();
|
RecipeSorter.register("botany:pigment", PigmentRecipe.class, RecipeSorter.Category.SHAPED, "");
|
||||||
if (fertilised) {
|
ItemStack yellow = new ItemStack(Blocks.yellow_flower, 1);
|
||||||
insulate += 3;
|
ItemStack red = new ItemStack(Blocks.red_flower, 1);
|
||||||
}
|
ItemStack blue = new ItemStack(Blocks.red_flower, 1, 7);
|
||||||
new CircuitGarden(moist, null, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 128 * insulate), icon);
|
|
||||||
new CircuitGarden(moist, EnumAcidity.ACID, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 1 + 128 * insulate), icon);
|
|
||||||
new CircuitGarden(moist, EnumAcidity.NEUTRAL, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 2 + 128 * insulate), icon);
|
|
||||||
new CircuitGarden(moist, EnumAcidity.ALKALINE, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 3 + 128 * insulate), icon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
for (boolean manual : new boolean[] { true, false }) {
|
||||||
public void postInit() {
|
for (boolean fertilised : new boolean[] { true, false }) {
|
||||||
GameRegistry.addRecipe(new CeramicTileRecipe());
|
for (EnumMoisture moist : EnumMoisture.values()) {
|
||||||
for (int mat = 0; mat < 4; ++mat) {
|
ItemStack icon = (moist == EnumMoisture.DRY) ? yellow
|
||||||
for (int insulate = 0; insulate < 6; ++insulate) {
|
: ((moist == EnumMoisture.NORMAL) ? red : blue);
|
||||||
ItemStack tubes = new ItemStack(Botany.insulatedTube, 2, mat + 128 * insulate);
|
int insulate = 2 - moist.ordinal();
|
||||||
ItemStack insulateStack = ItemInsulatedTube.getInsulateStack(tubes);
|
if (fertilised) {
|
||||||
ItemStack forestryTube = new ItemStack(Mods.forestry.item("thermionicTubes"), 1, mat);
|
insulate += 3;
|
||||||
GameRegistry.addShapelessRecipe(tubes, forestryTube, forestryTube, insulateStack);
|
}
|
||||||
}
|
new CircuitGarden(
|
||||||
}
|
moist,
|
||||||
|
null,
|
||||||
|
manual,
|
||||||
|
fertilised,
|
||||||
|
new ItemStack(Botany.insulatedTube, 1, 128 * insulate),
|
||||||
|
icon);
|
||||||
|
new CircuitGarden(
|
||||||
|
moist,
|
||||||
|
EnumAcidity.ACID,
|
||||||
|
manual,
|
||||||
|
fertilised,
|
||||||
|
new ItemStack(Botany.insulatedTube, 1, 1 + 128 * insulate),
|
||||||
|
icon);
|
||||||
|
new CircuitGarden(
|
||||||
|
moist,
|
||||||
|
EnumAcidity.NEUTRAL,
|
||||||
|
manual,
|
||||||
|
fertilised,
|
||||||
|
new ItemStack(Botany.insulatedTube, 1, 2 + 128 * insulate),
|
||||||
|
icon);
|
||||||
|
new CircuitGarden(
|
||||||
|
moist,
|
||||||
|
EnumAcidity.ALKALINE,
|
||||||
|
manual,
|
||||||
|
fertilised,
|
||||||
|
new ItemStack(Botany.insulatedTube, 1, 3 + 128 * insulate),
|
||||||
|
icon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.soil, 1, OreDictionary.WILDCARD_VALUE));
|
@Override
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.loam, 1, OreDictionary.WILDCARD_VALUE));
|
public void postInit() {
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.flowerbed, 1, OreDictionary.WILDCARD_VALUE));
|
GameRegistry.addRecipe(new CeramicTileRecipe());
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.soilNoWeed, 1, OreDictionary.WILDCARD_VALUE));
|
for (int mat = 0; mat < 4; ++mat) {
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.loamNoWeed, 1, OreDictionary.WILDCARD_VALUE));
|
for (int insulate = 0; insulate < 6; ++insulate) {
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.flowerbedNoWeed, 1, OreDictionary.WILDCARD_VALUE));
|
ItemStack tubes = new ItemStack(Botany.insulatedTube, 2, mat + 128 * insulate);
|
||||||
|
ItemStack insulateStack = ItemInsulatedTube.getInsulateStack(tubes);
|
||||||
|
ItemStack forestryTube = new ItemStack(Mods.forestry.item("thermionicTubes"), 1, mat);
|
||||||
|
GameRegistry.addShapelessRecipe(tubes, forestryTube, forestryTube, insulateStack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
GameRegistry.addShapelessRecipe(
|
||||||
Botany.trowelWood,
|
new ItemStack(Blocks.dirt),
|
||||||
new Object[]{
|
new ItemStack(Botany.soil, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
"d ", " x ", " s",
|
GameRegistry.addShapelessRecipe(
|
||||||
'd', Blocks.dirt,
|
new ItemStack(Blocks.dirt),
|
||||||
's', "stickWood",
|
new ItemStack(Botany.loam, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
'x', "plankWood"
|
GameRegistry.addShapelessRecipe(
|
||||||
}
|
new ItemStack(Blocks.dirt),
|
||||||
));
|
new ItemStack(Botany.flowerbed, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
GameRegistry.addShapelessRecipe(
|
||||||
Botany.trowelStone,
|
new ItemStack(Blocks.dirt),
|
||||||
new Object[]{
|
new ItemStack(Botany.soilNoWeed, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
"d ", " x ", " s",
|
GameRegistry.addShapelessRecipe(
|
||||||
'd', Blocks.dirt,
|
new ItemStack(Blocks.dirt),
|
||||||
's', "stickWood",
|
new ItemStack(Botany.loamNoWeed, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
'x', "cobblestone"
|
GameRegistry.addShapelessRecipe(
|
||||||
}
|
new ItemStack(Blocks.dirt),
|
||||||
));
|
new ItemStack(Botany.flowerbedNoWeed, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
|
||||||
Botany.trowelIron,
|
|
||||||
new Object[]{
|
|
||||||
"d ", " x ", " s",
|
|
||||||
'd', Blocks.dirt,
|
|
||||||
's', "stickWood",
|
|
||||||
'x', "ingotIron"
|
|
||||||
}
|
|
||||||
));
|
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
|
||||||
Botany.trowelGold,
|
|
||||||
new Object[]{
|
|
||||||
"d ", " x ", " s",
|
|
||||||
'd', Blocks.dirt,
|
|
||||||
's', "stickWood",
|
|
||||||
'x', "ingotGold"
|
|
||||||
}
|
|
||||||
));
|
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
|
||||||
Botany.trowelDiamond,
|
|
||||||
new Object[]{
|
|
||||||
"d ", " x ", " s",
|
|
||||||
'd', Blocks.dirt,
|
|
||||||
's', "stickWood",
|
|
||||||
'x', "gemDiamond"
|
|
||||||
}
|
|
||||||
));
|
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
|
||||||
Botany.soilMeter,
|
|
||||||
new Object[]{
|
|
||||||
" gg", " rg", "i ",
|
|
||||||
'g', "ingotGold",
|
|
||||||
'r', "dustRedstone",
|
|
||||||
'i', "ingotIron"
|
|
||||||
}
|
|
||||||
));
|
|
||||||
GameRegistry.addShapelessRecipe(
|
|
||||||
BotanyItems.Weedkiller.get(4),
|
|
||||||
new ItemStack(Items.spider_eye),
|
|
||||||
new ItemStack(Items.wheat_seeds),
|
|
||||||
new ItemStack(Items.wheat_seeds),
|
|
||||||
new ItemStack(Items.wheat_seeds)
|
|
||||||
);
|
|
||||||
|
|
||||||
GameRegistry.addShapelessRecipe(BotanyItems.AshPowder.get(4), Mods.forestry.stack("ash"));
|
GameRegistry.addRecipe(
|
||||||
GameRegistry.addShapelessRecipe(BotanyItems.MulchPowder.get(4), Mods.forestry.stack("mulch"));
|
new ShapedOreRecipe(
|
||||||
GameRegistry.addShapelessRecipe(BotanyItems.CompostPowder.get(4), Mods.forestry.stack("fertilizerBio"));
|
Botany.trowelWood,
|
||||||
GameRegistry.addShapelessRecipe(BotanyItems.FertiliserPowder.get(4), Mods.forestry.stack("fertilizerCompound"));
|
new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "plankWood" }));
|
||||||
GameRegistry.addShapelessRecipe(BotanyItems.PulpPowder.get(4), Mods.forestry.stack("woodPulp"));
|
GameRegistry.addRecipe(
|
||||||
GameRegistry.addRecipe(new ShapelessOreRecipe(
|
new ShapedOreRecipe(
|
||||||
BotanyItems.SulphurPowder.get(4),
|
Botany.trowelStone,
|
||||||
new Object[]{"dustSulphur"}
|
new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "cobblestone" }));
|
||||||
));
|
GameRegistry.addRecipe(
|
||||||
|
new ShapedOreRecipe(
|
||||||
|
Botany.trowelIron,
|
||||||
|
new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotIron" }));
|
||||||
|
GameRegistry.addRecipe(
|
||||||
|
new ShapedOreRecipe(
|
||||||
|
Botany.trowelGold,
|
||||||
|
new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotGold" }));
|
||||||
|
GameRegistry.addRecipe(
|
||||||
|
new ShapedOreRecipe(
|
||||||
|
Botany.trowelDiamond,
|
||||||
|
new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "gemDiamond" }));
|
||||||
|
GameRegistry.addRecipe(
|
||||||
|
new ShapedOreRecipe(
|
||||||
|
Botany.soilMeter,
|
||||||
|
new Object[] { " gg", " rg", "i ", 'g', "ingotGold", 'r', "dustRedstone", 'i', "ingotIron" }));
|
||||||
|
GameRegistry.addShapelessRecipe(
|
||||||
|
BotanyItems.Weedkiller.get(4),
|
||||||
|
new ItemStack(Items.spider_eye),
|
||||||
|
new ItemStack(Items.wheat_seeds),
|
||||||
|
new ItemStack(Items.wheat_seeds),
|
||||||
|
new ItemStack(Items.wheat_seeds));
|
||||||
|
|
||||||
GameRegistry.addRecipe(new ShapelessOreRecipe(
|
GameRegistry.addShapelessRecipe(BotanyItems.AshPowder.get(4), Mods.forestry.stack("ash"));
|
||||||
new ItemStack(Botany.pigment, 2, EnumFlowerColor.BLACK.ordinal()),
|
GameRegistry.addShapelessRecipe(BotanyItems.MulchPowder.get(4), Mods.forestry.stack("mulch"));
|
||||||
new Object[]{
|
GameRegistry.addShapelessRecipe(BotanyItems.CompostPowder.get(4), Mods.forestry.stack("fertilizerBio"));
|
||||||
"pigment",
|
GameRegistry.addShapelessRecipe(BotanyItems.FertiliserPowder.get(4), Mods.forestry.stack("fertilizerCompound"));
|
||||||
"pigment",
|
GameRegistry.addShapelessRecipe(BotanyItems.PulpPowder.get(4), Mods.forestry.stack("woodPulp"));
|
||||||
"dyeBlack"
|
GameRegistry
|
||||||
}
|
.addRecipe(new ShapelessOreRecipe(BotanyItems.SulphurPowder.get(4), new Object[] { "dustSulphur" }));
|
||||||
));
|
|
||||||
|
|
||||||
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.SulphurPowder.get(1), 1);
|
GameRegistry.addRecipe(
|
||||||
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.MulchPowder.get(1), 1);
|
new ShapelessOreRecipe(
|
||||||
ModuleGardening.queuedAcidFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "mulch")), 2);
|
new ItemStack(Botany.pigment, 2, EnumFlowerColor.BLACK.ordinal()),
|
||||||
|
new Object[] { "pigment", "pigment", "dyeBlack" }));
|
||||||
|
|
||||||
for (ItemStack stack : OreDictionary.getOres("dustSulfur")) {
|
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.SulphurPowder.get(1), 1);
|
||||||
ModuleGardening.queuedAcidFertilisers.put(stack, 2);
|
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.MulchPowder.get(1), 1);
|
||||||
}
|
ModuleGardening.queuedAcidFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "mulch")), 2);
|
||||||
|
|
||||||
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.AshPowder.get(1), 1);
|
for (ItemStack stack : OreDictionary.getOres("dustSulfur")) {
|
||||||
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.PulpPowder.get(1), 1);
|
ModuleGardening.queuedAcidFertilisers.put(stack, 2);
|
||||||
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "ash")), 2);
|
}
|
||||||
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "woodPulp")), 2);
|
|
||||||
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.CompostPowder.get(1), 1);
|
|
||||||
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.FertiliserPowder.get(1), 1);
|
|
||||||
ModuleGardening.queuedNutrientFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerBio")), 2);
|
|
||||||
ModuleGardening.queuedNutrientFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerCompound")), 2);
|
|
||||||
|
|
||||||
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAcidFertilisers.entrySet()) {
|
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.AshPowder.get(1), 1);
|
||||||
addAcidFertiliser(entry.getKey(), entry.getValue());
|
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.PulpPowder.get(1), 1);
|
||||||
}
|
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "ash")), 2);
|
||||||
|
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "woodPulp")), 2);
|
||||||
|
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.CompostPowder.get(1), 1);
|
||||||
|
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.FertiliserPowder.get(1), 1);
|
||||||
|
ModuleGardening.queuedNutrientFertilisers
|
||||||
|
.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerBio")), 2);
|
||||||
|
ModuleGardening.queuedNutrientFertilisers
|
||||||
|
.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerCompound")), 2);
|
||||||
|
|
||||||
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAlkalineFertilisers.entrySet()) {
|
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAcidFertilisers.entrySet()) {
|
||||||
addAlkalineFertiliser(entry.getKey(), entry.getValue());
|
addAcidFertiliser(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedNutrientFertilisers.entrySet()) {
|
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAlkalineFertilisers.entrySet()) {
|
||||||
addNutrientFertiliser(entry.getKey(), entry.getValue());
|
addAlkalineFertiliser(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
GameRegistry.addRecipe(
|
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedNutrientFertilisers.entrySet()) {
|
||||||
BotanyItems.Mortar.get(6),
|
addNutrientFertiliser(entry.getKey(), entry.getValue());
|
||||||
" c ", "cgc", " c ",
|
}
|
||||||
'c', Items.clay_ball,
|
|
||||||
'g', Blocks.gravel
|
|
||||||
);
|
|
||||||
|
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
GameRegistry
|
||||||
ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
|
.addRecipe(BotanyItems.Mortar.get(6), " c ", "cgc", " c ", 'c', Items.clay_ball, 'g', Blocks.gravel);
|
||||||
ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal());
|
|
||||||
GameRegistry.addShapelessRecipe(clay, Items.clay_ball, Items.clay_ball, Items.clay_ball, pigment);
|
|
||||||
GameRegistry.addSmelting(clay, TileEntityMetadata.getItemStack(Botany.ceramic, c.ordinal()), 0.0f);
|
|
||||||
ItemStack glass = TileEntityMetadata.getItemStack(Botany.stained, c.ordinal());
|
|
||||||
glass.stackSize = 4;
|
|
||||||
GameRegistry.addShapedRecipe(
|
|
||||||
glass,
|
|
||||||
" g ", "gpg", " g ",
|
|
||||||
'g', Blocks.glass,
|
|
||||||
'p', pigment
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
GameRegistry.addRecipe(new PigmentRecipe());
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
}
|
ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
|
||||||
|
ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal());
|
||||||
|
GameRegistry.addShapelessRecipe(clay, Items.clay_ball, Items.clay_ball, Items.clay_ball, pigment);
|
||||||
|
GameRegistry.addSmelting(clay, TileEntityMetadata.getItemStack(Botany.ceramic, c.ordinal()), 0.0f);
|
||||||
|
ItemStack glass = TileEntityMetadata.getItemStack(Botany.stained, c.ordinal());
|
||||||
|
glass.stackSize = 4;
|
||||||
|
GameRegistry.addShapedRecipe(glass, " g ", "gpg", " g ", 'g', Blocks.glass, 'p', pigment);
|
||||||
|
}
|
||||||
|
|
||||||
private ItemStack getStack(int type, int pH, int moisture) {
|
GameRegistry.addRecipe(new PigmentRecipe());
|
||||||
if (type < 0 || type > 2 || pH < 0 || pH > 2 || moisture < 0 || moisture > 2) {
|
}
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new ItemStack(Gardening.getSoilBlock(EnumSoilType.values()[type]), 1, BlockSoil.getMeta(EnumAcidity.values()[pH], EnumMoisture.values()[moisture]));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addAcidFertiliser(ItemStack stack, int strengthMax) {
|
private ItemStack getStack(int type, int pH, int moisture) {
|
||||||
if (stack == null) {
|
if (type < 0 || type > 2 || pH < 0 || pH > 2 || moisture < 0 || moisture > 2) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
return new ItemStack(
|
||||||
|
Gardening.getSoilBlock(EnumSoilType.values()[type]),
|
||||||
|
1,
|
||||||
|
BlockSoil.getMeta(EnumAcidity.values()[pH], EnumMoisture.values()[moisture]));
|
||||||
|
}
|
||||||
|
|
||||||
Gardening.fertiliserAcid.put(stack, strengthMax);
|
private void addAcidFertiliser(ItemStack stack, int strengthMax) {
|
||||||
for (int moisture = 0; moisture < 3; ++moisture) {
|
if (stack == null) {
|
||||||
for (int pH = 0; pH < 3; ++pH) {
|
return;
|
||||||
for (int type = 0; type < 3; ++type) {
|
}
|
||||||
int numOfBlocks = strengthMax * strengthMax;
|
|
||||||
for (int strength = 1; strength < strengthMax; ++strength) {
|
|
||||||
ItemStack start = getStack(type, pH, moisture);
|
|
||||||
ItemStack end = getStack(type, pH - strength, moisture);
|
|
||||||
if (end != null) {
|
|
||||||
end.stackSize = numOfBlocks;
|
|
||||||
Object[] stacks = new Object[numOfBlocks + 1];
|
|
||||||
for (int i = 0; i < numOfBlocks; ++i) {
|
|
||||||
stacks[i] = start;
|
|
||||||
}
|
|
||||||
stacks[numOfBlocks] = stack.copy();
|
|
||||||
GameRegistry.addShapelessRecipe(end, stacks);
|
|
||||||
}
|
|
||||||
numOfBlocks /= 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addAlkalineFertiliser(ItemStack stack, int strengthMax) {
|
Gardening.fertiliserAcid.put(stack, strengthMax);
|
||||||
if (stack == null) {
|
for (int moisture = 0; moisture < 3; ++moisture) {
|
||||||
return;
|
for (int pH = 0; pH < 3; ++pH) {
|
||||||
}
|
for (int type = 0; type < 3; ++type) {
|
||||||
|
int numOfBlocks = strengthMax * strengthMax;
|
||||||
|
for (int strength = 1; strength < strengthMax; ++strength) {
|
||||||
|
ItemStack start = getStack(type, pH, moisture);
|
||||||
|
ItemStack end = getStack(type, pH - strength, moisture);
|
||||||
|
if (end != null) {
|
||||||
|
end.stackSize = numOfBlocks;
|
||||||
|
Object[] stacks = new Object[numOfBlocks + 1];
|
||||||
|
for (int i = 0; i < numOfBlocks; ++i) {
|
||||||
|
stacks[i] = start;
|
||||||
|
}
|
||||||
|
stacks[numOfBlocks] = stack.copy();
|
||||||
|
GameRegistry.addShapelessRecipe(end, stacks);
|
||||||
|
}
|
||||||
|
numOfBlocks /= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Gardening.fertiliserAlkaline.put(stack, strengthMax);
|
private void addAlkalineFertiliser(ItemStack stack, int strengthMax) {
|
||||||
for (int moisture = 0; moisture < 3; ++moisture) {
|
if (stack == null) {
|
||||||
for (int pH = 0; pH < 3; ++pH) {
|
return;
|
||||||
for (int type = 0; type < 3; ++type) {
|
}
|
||||||
int numOfBlocks = strengthMax * strengthMax;
|
|
||||||
for (int strength = 1; strength < strengthMax; ++strength) {
|
|
||||||
ItemStack start = getStack(type, pH, moisture);
|
|
||||||
ItemStack end = getStack(type, pH + strength, moisture);
|
|
||||||
if (end != null) {
|
|
||||||
end.stackSize = numOfBlocks;
|
|
||||||
Object[] stacks = new Object[numOfBlocks + 1];
|
|
||||||
for (int i = 0; i < numOfBlocks; ++i) {
|
|
||||||
stacks[i] = start;
|
|
||||||
}
|
|
||||||
stacks[numOfBlocks] = stack.copy();
|
|
||||||
GameRegistry.addShapelessRecipe(end, stacks);
|
|
||||||
}
|
|
||||||
numOfBlocks /= 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addNutrientFertiliser(ItemStack stack, int strengthMax) {
|
Gardening.fertiliserAlkaline.put(stack, strengthMax);
|
||||||
if (stack == null) {
|
for (int moisture = 0; moisture < 3; ++moisture) {
|
||||||
return;
|
for (int pH = 0; pH < 3; ++pH) {
|
||||||
}
|
for (int type = 0; type < 3; ++type) {
|
||||||
|
int numOfBlocks = strengthMax * strengthMax;
|
||||||
|
for (int strength = 1; strength < strengthMax; ++strength) {
|
||||||
|
ItemStack start = getStack(type, pH, moisture);
|
||||||
|
ItemStack end = getStack(type, pH + strength, moisture);
|
||||||
|
if (end != null) {
|
||||||
|
end.stackSize = numOfBlocks;
|
||||||
|
Object[] stacks = new Object[numOfBlocks + 1];
|
||||||
|
for (int i = 0; i < numOfBlocks; ++i) {
|
||||||
|
stacks[i] = start;
|
||||||
|
}
|
||||||
|
stacks[numOfBlocks] = stack.copy();
|
||||||
|
GameRegistry.addShapelessRecipe(end, stacks);
|
||||||
|
}
|
||||||
|
numOfBlocks /= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Gardening.fertiliserNutrient.put(stack, strengthMax);
|
private void addNutrientFertiliser(ItemStack stack, int strengthMax) {
|
||||||
for (int moisture = 0; moisture < 3; ++moisture) {
|
if (stack == null) {
|
||||||
for (int pH = 0; pH < 3; ++pH) {
|
return;
|
||||||
for (int type = 0; type < 3; ++type) {
|
}
|
||||||
int numOfBlocks = strengthMax * strengthMax;
|
|
||||||
for (int strength = 1; strength < strengthMax; ++strength) {
|
Gardening.fertiliserNutrient.put(stack, strengthMax);
|
||||||
ItemStack start = getStack(type, pH, moisture);
|
for (int moisture = 0; moisture < 3; ++moisture) {
|
||||||
ItemStack end = getStack(type + strength, pH, moisture);
|
for (int pH = 0; pH < 3; ++pH) {
|
||||||
if (end != null) {
|
for (int type = 0; type < 3; ++type) {
|
||||||
end.stackSize = numOfBlocks;
|
int numOfBlocks = strengthMax * strengthMax;
|
||||||
Object[] stacks = new Object[numOfBlocks + 1];
|
for (int strength = 1; strength < strengthMax; ++strength) {
|
||||||
for (int i = 0; i < numOfBlocks; ++i) {
|
ItemStack start = getStack(type, pH, moisture);
|
||||||
stacks[i] = start;
|
ItemStack end = getStack(type + strength, pH, moisture);
|
||||||
}
|
if (end != null) {
|
||||||
stacks[numOfBlocks] = stack.copy();
|
end.stackSize = numOfBlocks;
|
||||||
GameRegistry.addShapelessRecipe(end, stacks);
|
Object[] stacks = new Object[numOfBlocks + 1];
|
||||||
}
|
for (int i = 0; i < numOfBlocks; ++i) {
|
||||||
numOfBlocks /= 2;
|
stacks[i] = start;
|
||||||
}
|
}
|
||||||
}
|
stacks[numOfBlocks] = stack.copy();
|
||||||
}
|
GameRegistry.addShapelessRecipe(end, stacks);
|
||||||
}
|
}
|
||||||
}
|
numOfBlocks /= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,43 +3,44 @@ package binnie.botany.genetics;
|
|||||||
import forestry.api.genetics.IAlleleInteger;
|
import forestry.api.genetics.IAlleleInteger;
|
||||||
|
|
||||||
public class AlleleColor implements IAlleleInteger {
|
public class AlleleColor implements IAlleleInteger {
|
||||||
private String uid;
|
|
||||||
private int value;
|
|
||||||
private EnumFlowerColor color;
|
|
||||||
private boolean dominant = true;
|
|
||||||
|
|
||||||
public AlleleColor(EnumFlowerColor color, String uid, int value) {
|
private String uid;
|
||||||
this.color = color;
|
private int value;
|
||||||
this.uid = uid;
|
private EnumFlowerColor color;
|
||||||
this.value = value;
|
private boolean dominant = true;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public AlleleColor(EnumFlowerColor color, String uid, int value) {
|
||||||
public String getUID() {
|
this.color = color;
|
||||||
return uid;
|
this.uid = uid;
|
||||||
}
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDominant() {
|
public String getUID() {
|
||||||
return dominant;
|
return uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public boolean isDominant() {
|
||||||
return color.getName();
|
return dominant;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getValue() {
|
public String getName() {
|
||||||
return value;
|
return color.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnumFlowerColor getColor() {
|
@Override
|
||||||
return color;
|
public int getValue() {
|
||||||
}
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
public EnumFlowerColor getColor() {
|
||||||
public String getUnlocalizedName() {
|
return color;
|
||||||
return getUID();
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public String getUnlocalizedName() {
|
||||||
|
return getUID();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,44 +1,46 @@
|
|||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import binnie.botany.api.IAlleleFlowerEffect;
|
import binnie.botany.api.IAlleleFlowerEffect;
|
||||||
import binnie.botany.api.IFlowerGenome;
|
import binnie.botany.api.IFlowerGenome;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
import forestry.api.genetics.IEffectData;
|
import forestry.api.genetics.IEffectData;
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class AlleleEffectNone implements IAlleleFlowerEffect {
|
public class AlleleEffectNone implements IAlleleFlowerEffect {
|
||||||
@Override
|
|
||||||
public boolean isCombinable() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IEffectData validateStorage(IEffectData storedData) {
|
public boolean isCombinable() {
|
||||||
return storedData;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUID() {
|
public IEffectData validateStorage(IEffectData storedData) {
|
||||||
return "binnie.flowerEffectNone";
|
return storedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDominant() {
|
public String getUID() {
|
||||||
return false;
|
return "binnie.flowerEffectNone";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public boolean isDominant() {
|
||||||
return I18N.localise("forestry.allele.effect.none");
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IEffectData doEffect(IFlowerGenome genome, IEffectData storedData, World world, int x, int y, int z) {
|
public String getName() {
|
||||||
return storedData;
|
return I18N.localise("forestry.allele.effect.none");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName() {
|
public IEffectData doEffect(IFlowerGenome genome, IEffectData storedData, World world, int x, int y, int z) {
|
||||||
return getUID();
|
return storedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUnlocalizedName() {
|
||||||
|
return getUID();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,30 +1,31 @@
|
|||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import binnie.botany.api.IBotanistTracker;
|
import binnie.botany.api.IBotanistTracker;
|
||||||
import forestry.api.genetics.IBreedingTracker;
|
import forestry.api.genetics.IBreedingTracker;
|
||||||
import forestry.api.genetics.IIndividual;
|
import forestry.api.genetics.IIndividual;
|
||||||
import forestry.core.genetics.BreedingTracker;
|
import forestry.core.genetics.BreedingTracker;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
|
|
||||||
public class BotanistTracker extends BreedingTracker implements IBotanistTracker {
|
public class BotanistTracker extends BreedingTracker implements IBotanistTracker {
|
||||||
public BotanistTracker(String s) {
|
|
||||||
super(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public BotanistTracker(String s) {
|
||||||
public void registerPickup(IIndividual individual) {
|
super(s);
|
||||||
// ignored
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IBreedingTracker getBreedingTracker(EntityPlayer player) {
|
public void registerPickup(IIndividual individual) {
|
||||||
return Binnie.Genetics.getFlowerRoot()
|
// ignored
|
||||||
.getBreedingTracker(player.worldObj, player.getGameProfile());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String speciesRootUID() {
|
protected IBreedingTracker getBreedingTracker(EntityPlayer player) {
|
||||||
return "rootFlowers";
|
return Binnie.Genetics.getFlowerRoot().getBreedingTracker(player.worldObj, player.getGameProfile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String speciesRootUID() {
|
||||||
|
return "rootFlowers";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,41 +4,41 @@ import binnie.botany.api.IColourMix;
|
|||||||
import binnie.botany.api.IFlowerColor;
|
import binnie.botany.api.IFlowerColor;
|
||||||
|
|
||||||
public class ColorMix implements IColourMix {
|
public class ColorMix implements IColourMix {
|
||||||
protected IFlowerColor color1;
|
|
||||||
protected IFlowerColor color2;
|
|
||||||
protected IFlowerColor result;
|
|
||||||
protected int chance;
|
|
||||||
|
|
||||||
public ColorMix(IFlowerColor color1, IFlowerColor color2, IFlowerColor result, int chance) {
|
protected IFlowerColor color1;
|
||||||
this.color1 = color1;
|
protected IFlowerColor color2;
|
||||||
this.color2 = color2;
|
protected IFlowerColor result;
|
||||||
this.result = result;
|
protected int chance;
|
||||||
this.chance = chance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ColorMix(IFlowerColor color1, IFlowerColor color2, IFlowerColor result, int chance) {
|
||||||
public IFlowerColor getColor1() {
|
this.color1 = color1;
|
||||||
return color1;
|
this.color2 = color2;
|
||||||
}
|
this.result = result;
|
||||||
|
this.chance = chance;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlowerColor getColor2() {
|
public IFlowerColor getColor1() {
|
||||||
return color2;
|
return color1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMutation(IFlowerColor color1, IFlowerColor color2) {
|
public IFlowerColor getColor2() {
|
||||||
return (color1 == this.color1 && color2 == this.color2)
|
return color2;
|
||||||
|| (color1 == this.color2 && color2 == this.color1);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getChance() {
|
public boolean isMutation(IFlowerColor color1, IFlowerColor color2) {
|
||||||
return chance;
|
return (color1 == this.color1 && color2 == this.color2) || (color1 == this.color2 && color2 == this.color1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlowerColor getResult() {
|
public int getChance() {
|
||||||
return result;
|
return chance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IFlowerColor getResult() {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,152 +1,154 @@
|
|||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
import binnie.botany.api.IFlowerType;
|
import binnie.botany.api.IFlowerType;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
|
|
||||||
public enum EnumFlowerType implements IFlowerType {
|
public enum EnumFlowerType implements IFlowerType {
|
||||||
DANDELION,
|
|
||||||
POPPY,
|
|
||||||
ORCHID,
|
|
||||||
ALLIUM,
|
|
||||||
BLUET,
|
|
||||||
TULIP,
|
|
||||||
DAISY,
|
|
||||||
CORNFLOWER,
|
|
||||||
PANSY,
|
|
||||||
IRIS,
|
|
||||||
LAVENDER(2),
|
|
||||||
VIOLA,
|
|
||||||
DAFFODIL,
|
|
||||||
DAHLIA,
|
|
||||||
PEONY(2),
|
|
||||||
ROSE(2),
|
|
||||||
LILAC(2),
|
|
||||||
HYDRANGEA(2),
|
|
||||||
FOXGLOVE(2),
|
|
||||||
ZINNIA,
|
|
||||||
MUMS,
|
|
||||||
MARIGOLD,
|
|
||||||
GERANIUM,
|
|
||||||
AZALEA,
|
|
||||||
PRIMROSE,
|
|
||||||
ASTER,
|
|
||||||
CARNATION,
|
|
||||||
LILY,
|
|
||||||
YARROW,
|
|
||||||
PETUNIA,
|
|
||||||
AGAPANTHUS,
|
|
||||||
FUCHSIA,
|
|
||||||
DIANTHUS,
|
|
||||||
FORGET,
|
|
||||||
ANEMONE,
|
|
||||||
AQUILEGIA,
|
|
||||||
EDELWEISS,
|
|
||||||
SCABIOUS,
|
|
||||||
CONEFLOWER,
|
|
||||||
GAILLARDIA,
|
|
||||||
AURICULA,
|
|
||||||
CAMELLIA(2),
|
|
||||||
GOLDENROD(2),
|
|
||||||
ALTHEA(2),
|
|
||||||
PENSTEMON(2),
|
|
||||||
DELPHINIUM(2),
|
|
||||||
HOLLYHOCK(2);
|
|
||||||
|
|
||||||
protected int sections;
|
DANDELION,
|
||||||
protected IIcon[] stem;
|
POPPY,
|
||||||
protected IIcon[] petal;
|
ORCHID,
|
||||||
protected IIcon[] variant;
|
ALLIUM,
|
||||||
protected IIcon[] unflowered;
|
BLUET,
|
||||||
protected IIcon seedStem;
|
TULIP,
|
||||||
protected IIcon seedPetal;
|
DAISY,
|
||||||
protected IIcon seedVariant;
|
CORNFLOWER,
|
||||||
protected IIcon pollenStem;
|
PANSY,
|
||||||
protected IIcon pollenPetal;
|
IRIS,
|
||||||
protected IIcon pollenVariant;
|
LAVENDER(2),
|
||||||
protected IIcon blank;
|
VIOLA,
|
||||||
|
DAFFODIL,
|
||||||
|
DAHLIA,
|
||||||
|
PEONY(2),
|
||||||
|
ROSE(2),
|
||||||
|
LILAC(2),
|
||||||
|
HYDRANGEA(2),
|
||||||
|
FOXGLOVE(2),
|
||||||
|
ZINNIA,
|
||||||
|
MUMS,
|
||||||
|
MARIGOLD,
|
||||||
|
GERANIUM,
|
||||||
|
AZALEA,
|
||||||
|
PRIMROSE,
|
||||||
|
ASTER,
|
||||||
|
CARNATION,
|
||||||
|
LILY,
|
||||||
|
YARROW,
|
||||||
|
PETUNIA,
|
||||||
|
AGAPANTHUS,
|
||||||
|
FUCHSIA,
|
||||||
|
DIANTHUS,
|
||||||
|
FORGET,
|
||||||
|
ANEMONE,
|
||||||
|
AQUILEGIA,
|
||||||
|
EDELWEISS,
|
||||||
|
SCABIOUS,
|
||||||
|
CONEFLOWER,
|
||||||
|
GAILLARDIA,
|
||||||
|
AURICULA,
|
||||||
|
CAMELLIA(2),
|
||||||
|
GOLDENROD(2),
|
||||||
|
ALTHEA(2),
|
||||||
|
PENSTEMON(2),
|
||||||
|
DELPHINIUM(2),
|
||||||
|
HOLLYHOCK(2);
|
||||||
|
|
||||||
EnumFlowerType() {
|
protected int sections;
|
||||||
this(1);
|
protected IIcon[] stem;
|
||||||
}
|
protected IIcon[] petal;
|
||||||
|
protected IIcon[] variant;
|
||||||
|
protected IIcon[] unflowered;
|
||||||
|
protected IIcon seedStem;
|
||||||
|
protected IIcon seedPetal;
|
||||||
|
protected IIcon seedVariant;
|
||||||
|
protected IIcon pollenStem;
|
||||||
|
protected IIcon pollenPetal;
|
||||||
|
protected IIcon pollenVariant;
|
||||||
|
protected IIcon blank;
|
||||||
|
|
||||||
EnumFlowerType(int sections) {
|
EnumFlowerType() {
|
||||||
this.sections = sections;
|
this(1);
|
||||||
stem = new IIcon[sections];
|
}
|
||||||
petal = new IIcon[sections];
|
|
||||||
variant = new IIcon[sections];
|
|
||||||
unflowered = new IIcon[sections];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
EnumFlowerType(int sections) {
|
||||||
public IIcon getStem(EnumFlowerStage stage, boolean flowered, int section) {
|
this.sections = sections;
|
||||||
if (stage == EnumFlowerStage.SEED) {
|
stem = new IIcon[sections];
|
||||||
return seedStem;
|
petal = new IIcon[sections];
|
||||||
}
|
variant = new IIcon[sections];
|
||||||
if (stage == EnumFlowerStage.POLLEN) {
|
unflowered = new IIcon[sections];
|
||||||
return pollenStem;
|
}
|
||||||
}
|
|
||||||
return stem[section % sections];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getPetalIcon(EnumFlowerStage stage, boolean flowered, int section) {
|
public IIcon getStem(EnumFlowerStage stage, boolean flowered, int section) {
|
||||||
if (stage == EnumFlowerStage.SEED) {
|
if (stage == EnumFlowerStage.SEED) {
|
||||||
return seedPetal;
|
return seedStem;
|
||||||
}
|
}
|
||||||
if (stage == EnumFlowerStage.POLLEN){
|
if (stage == EnumFlowerStage.POLLEN) {
|
||||||
return pollenPetal;
|
return pollenStem;
|
||||||
}
|
}
|
||||||
if (flowered) {
|
return stem[section % sections];
|
||||||
return petal[section % sections];
|
}
|
||||||
}
|
|
||||||
return unflowered[section % sections];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getVariantIcon(EnumFlowerStage stage, boolean flowered, int section) {
|
public IIcon getPetalIcon(EnumFlowerStage stage, boolean flowered, int section) {
|
||||||
if (stage == EnumFlowerStage.SEED) {
|
if (stage == EnumFlowerStage.SEED) {
|
||||||
return seedVariant;
|
return seedPetal;
|
||||||
}
|
}
|
||||||
if (stage == EnumFlowerStage.POLLEN) {
|
if (stage == EnumFlowerStage.POLLEN) {
|
||||||
return pollenVariant;
|
return pollenPetal;
|
||||||
}
|
}
|
||||||
return flowered ? variant[section % sections] : blank;
|
if (flowered) {
|
||||||
}
|
return petal[section % sections];
|
||||||
|
}
|
||||||
|
return unflowered[section % sections];
|
||||||
|
}
|
||||||
|
|
||||||
public void registerIcons(IIconRegister register) {
|
@Override
|
||||||
for (int i = 0; i < sections; ++i) {
|
public IIcon getVariantIcon(EnumFlowerStage stage, boolean flowered, int section) {
|
||||||
String suf = (i == 0) ? "" : ("" + (i + 1));
|
if (stage == EnumFlowerStage.SEED) {
|
||||||
String pre = (sections == 1) ? "" : "double/";
|
return seedVariant;
|
||||||
String id = pre + toString().toLowerCase() + suf;
|
}
|
||||||
stem[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".0");
|
if (stage == EnumFlowerStage.POLLEN) {
|
||||||
petal[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".1");
|
return pollenVariant;
|
||||||
variant[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".2");
|
}
|
||||||
unflowered[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".3");
|
return flowered ? variant[section % sections] : blank;
|
||||||
}
|
}
|
||||||
|
|
||||||
blank = Botany.proxy.getIcon(register, "flowers/blank");
|
public void registerIcons(IIconRegister register) {
|
||||||
seedStem = Botany.proxy.getIcon(register, "flowers/seed.0");
|
for (int i = 0; i < sections; ++i) {
|
||||||
seedPetal = Botany.proxy.getIcon(register, "flowers/seed.1");
|
String suf = (i == 0) ? "" : ("" + (i + 1));
|
||||||
seedVariant = Botany.proxy.getIcon(register, "flowers/seed.2");
|
String pre = (sections == 1) ? "" : "double/";
|
||||||
pollenStem = Botany.proxy.getIcon(register, "flowers/pollen.0");
|
String id = pre + toString().toLowerCase() + suf;
|
||||||
pollenPetal = Botany.proxy.getIcon(register, "flowers/pollen.1");
|
stem[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".0");
|
||||||
pollenVariant = Botany.proxy.getIcon(register, "flowers/pollen.2");
|
petal[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".1");
|
||||||
}
|
variant[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".2");
|
||||||
|
unflowered[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".3");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
blank = Botany.proxy.getIcon(register, "flowers/blank");
|
||||||
public int getID() {
|
seedStem = Botany.proxy.getIcon(register, "flowers/seed.0");
|
||||||
return ordinal();
|
seedPetal = Botany.proxy.getIcon(register, "flowers/seed.1");
|
||||||
}
|
seedVariant = Botany.proxy.getIcon(register, "flowers/seed.2");
|
||||||
|
pollenStem = Botany.proxy.getIcon(register, "flowers/pollen.0");
|
||||||
|
pollenPetal = Botany.proxy.getIcon(register, "flowers/pollen.1");
|
||||||
|
pollenVariant = Botany.proxy.getIcon(register, "flowers/pollen.2");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSections() {
|
public int getID() {
|
||||||
return sections;
|
return ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIcon getBlank() {
|
@Override
|
||||||
return blank;
|
public int getSections() {
|
||||||
}
|
return sections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IIcon getBlank() {
|
||||||
|
return blank;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import binnie.botany.api.EnumFlowerChromosome;
|
import binnie.botany.api.EnumFlowerChromosome;
|
||||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||||
import binnie.botany.api.IColourMix;
|
import binnie.botany.api.IColourMix;
|
||||||
@@ -15,249 +21,260 @@ import forestry.api.genetics.IAllele;
|
|||||||
import forestry.api.genetics.IChromosome;
|
import forestry.api.genetics.IChromosome;
|
||||||
import forestry.core.genetics.Chromosome;
|
import forestry.core.genetics.Chromosome;
|
||||||
import forestry.core.genetics.Individual;
|
import forestry.core.genetics.Individual;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Flower extends Individual implements IFlower {
|
public class Flower extends Individual implements IFlower {
|
||||||
public IFlowerGenome genome;
|
|
||||||
public IFlowerGenome mate;
|
|
||||||
|
|
||||||
protected int age;
|
public IFlowerGenome genome;
|
||||||
protected boolean wilting;
|
public IFlowerGenome mate;
|
||||||
protected boolean flowered;
|
|
||||||
|
|
||||||
public Flower(NBTTagCompound nbttagcompound) {
|
protected int age;
|
||||||
age = 0;
|
protected boolean wilting;
|
||||||
wilting = false;
|
protected boolean flowered;
|
||||||
readFromNBT(nbttagcompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Flower(IFlowerGenome genome, int age) {
|
public Flower(NBTTagCompound nbttagcompound) {
|
||||||
this.genome = genome;
|
age = 0;
|
||||||
this.age = age;
|
wilting = false;
|
||||||
wilting = false;
|
readFromNBT(nbttagcompound);
|
||||||
flowered = age > 0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public Flower(IFlowerGenome genome, int age) {
|
||||||
public String getDisplayName() {
|
this.genome = genome;
|
||||||
IAlleleFlowerSpecies species = getGenome().getPrimary();
|
this.age = age;
|
||||||
String name = "";
|
wilting = false;
|
||||||
if (species != null) {
|
flowered = age > 0;
|
||||||
name += species.getName();
|
}
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTooltip(List<String> list) {
|
public String getDisplayName() {
|
||||||
IAlleleFlowerSpecies primary = genome.getPrimary();
|
IAlleleFlowerSpecies species = getGenome().getPrimary();
|
||||||
IAlleleFlowerSpecies secondary = genome.getSecondary();
|
String name = "";
|
||||||
if (!isPureBred(EnumFlowerChromosome.SPECIES)) {
|
if (species != null) {
|
||||||
list.add(EnumChatFormatting.BLUE + I18N.localise("botany.item.tooltip.hybrid", primary.getName(), secondary.getName()));
|
name += species.getName();
|
||||||
}
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
list.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.age", getAge()));
|
@Override
|
||||||
list.add(EnumChatFormatting.GREEN + I18N.localise("botany.item.tooltip.temperature", AlleleHelper.toDisplay(primary.getTemperature()), AlleleHelper.toDisplay(genome.getToleranceTemperature())));
|
public void addTooltip(List<String> list) {
|
||||||
list.add(EnumChatFormatting.GREEN + I18N.localise("botany.item.tooltip.moisture", AlleleHelper.toDisplay(primary.getMoisture()), AlleleHelper.toDisplay(genome.getToleranceMoisture())));
|
IAlleleFlowerSpecies primary = genome.getPrimary();
|
||||||
list.add(EnumChatFormatting.GREEN + I18N.localise("botany.item.tooltip.pH", AlleleHelper.toDisplay(primary.getHumidity()), AlleleHelper.toDisplay(genome.getTolerancePH())));
|
IAlleleFlowerSpecies secondary = genome.getSecondary();
|
||||||
list.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.fertility", genome.getFertility()));
|
if (!isPureBred(EnumFlowerChromosome.SPECIES)) {
|
||||||
}
|
list.add(
|
||||||
|
EnumChatFormatting.BLUE
|
||||||
|
+ I18N.localise("botany.item.tooltip.hybrid", primary.getName(), secondary.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
list.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.age", getAge()));
|
||||||
public String getIdent() {
|
list.add(
|
||||||
return getGenome().getPrimary().getUID();
|
EnumChatFormatting.GREEN + I18N.localise(
|
||||||
}
|
"botany.item.tooltip.temperature",
|
||||||
|
AlleleHelper.toDisplay(primary.getTemperature()),
|
||||||
|
AlleleHelper.toDisplay(genome.getToleranceTemperature())));
|
||||||
|
list.add(
|
||||||
|
EnumChatFormatting.GREEN + I18N.localise(
|
||||||
|
"botany.item.tooltip.moisture",
|
||||||
|
AlleleHelper.toDisplay(primary.getMoisture()),
|
||||||
|
AlleleHelper.toDisplay(genome.getToleranceMoisture())));
|
||||||
|
list.add(
|
||||||
|
EnumChatFormatting.GREEN + I18N.localise(
|
||||||
|
"botany.item.tooltip.pH",
|
||||||
|
AlleleHelper.toDisplay(primary.getHumidity()),
|
||||||
|
AlleleHelper.toDisplay(genome.getTolerancePH())));
|
||||||
|
list.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.fertility", genome.getFertility()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
public String getIdent() {
|
||||||
super.readFromNBT(nbttagcompound);
|
return getGenome().getPrimary().getUID();
|
||||||
if (nbttagcompound == null) {
|
}
|
||||||
genome = BotanyCore.getFlowerRoot().templateAsGenome(BotanyCore.getFlowerRoot().getDefaultTemplate());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
age = nbttagcompound.getInteger("Age");
|
@Override
|
||||||
wilting = nbttagcompound.getBoolean("Wilt");
|
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||||
flowered = nbttagcompound.getBoolean("Flowered");
|
super.readFromNBT(nbttagcompound);
|
||||||
if (nbttagcompound.hasKey("Genome")) {
|
if (nbttagcompound == null) {
|
||||||
genome = new FlowerGenome(nbttagcompound.getCompoundTag("Genome"));
|
genome = BotanyCore.getFlowerRoot().templateAsGenome(BotanyCore.getFlowerRoot().getDefaultTemplate());
|
||||||
}
|
return;
|
||||||
if (nbttagcompound.hasKey("Mate")) {
|
}
|
||||||
mate = new FlowerGenome(nbttagcompound.getCompoundTag("Mate"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
age = nbttagcompound.getInteger("Age");
|
||||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
wilting = nbttagcompound.getBoolean("Wilt");
|
||||||
super.writeToNBT(nbttagcompound);
|
flowered = nbttagcompound.getBoolean("Flowered");
|
||||||
nbttagcompound.setInteger("Age", age);
|
if (nbttagcompound.hasKey("Genome")) {
|
||||||
nbttagcompound.setBoolean("Wilt", wilting);
|
genome = new FlowerGenome(nbttagcompound.getCompoundTag("Genome"));
|
||||||
nbttagcompound.setBoolean("Flowered", flowered);
|
}
|
||||||
|
if (nbttagcompound.hasKey("Mate")) {
|
||||||
|
mate = new FlowerGenome(nbttagcompound.getCompoundTag("Mate"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (genome != null) {
|
@Override
|
||||||
NBTTagCompound NBTmachine = new NBTTagCompound();
|
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||||
genome.writeToNBT(NBTmachine);
|
super.writeToNBT(nbttagcompound);
|
||||||
nbttagcompound.setTag("Genome", NBTmachine);
|
nbttagcompound.setInteger("Age", age);
|
||||||
}
|
nbttagcompound.setBoolean("Wilt", wilting);
|
||||||
|
nbttagcompound.setBoolean("Flowered", flowered);
|
||||||
|
|
||||||
if (mate != null) {
|
if (genome != null) {
|
||||||
NBTTagCompound NBTmachine = new NBTTagCompound();
|
NBTTagCompound NBTmachine = new NBTTagCompound();
|
||||||
mate.writeToNBT(NBTmachine);
|
genome.writeToNBT(NBTmachine);
|
||||||
nbttagcompound.setTag("Mate", NBTmachine);
|
nbttagcompound.setTag("Genome", NBTmachine);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public int getMetadata() {
|
if (mate != null) {
|
||||||
return 0;
|
NBTTagCompound NBTmachine = new NBTTagCompound();
|
||||||
}
|
mate.writeToNBT(NBTmachine);
|
||||||
|
nbttagcompound.setTag("Mate", NBTmachine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
public int getMetadata() {
|
||||||
public IFlowerGenome getGenome() {
|
return 0;
|
||||||
return genome;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mate(IFlower other) {
|
public IFlowerGenome getGenome() {
|
||||||
mate = new FlowerGenome(other.getGenome().getChromosomes());
|
return genome;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlowerGenome getMate() {
|
public void mate(IFlower other) {
|
||||||
return mate;
|
mate = new FlowerGenome(other.getGenome().getChromosomes());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlower copy() {
|
public IFlowerGenome getMate() {
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
return mate;
|
||||||
writeToNBT(nbttagcompound);
|
}
|
||||||
return new Flower(nbttagcompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAge() {
|
public IFlower copy() {
|
||||||
return age;
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
}
|
writeToNBT(nbttagcompound);
|
||||||
|
return new Flower(nbttagcompound);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAge(int age) {
|
public int getAge() {
|
||||||
this.age = age;
|
return age;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void age() {
|
public void setAge(int age) {
|
||||||
if (age < 15) {
|
this.age = age;
|
||||||
age++;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxAge() {
|
public void age() {
|
||||||
return getGenome().getLifespan();
|
if (age < 15) {
|
||||||
}
|
age++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWilted() {
|
public int getMaxAge() {
|
||||||
return wilting;
|
return getGenome().getLifespan();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setWilted(boolean value) {
|
public boolean isWilted() {
|
||||||
wilting = value;
|
return wilting;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasFlowered() {
|
public void setWilted(boolean value) {
|
||||||
return flowered;
|
wilting = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFlowered(boolean value) {
|
public boolean hasFlowered() {
|
||||||
flowered = value;
|
return flowered;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeMate() {
|
public void setFlowered(boolean value) {
|
||||||
mate = null;
|
flowered = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlower getOffspring(World world) {
|
public void removeMate() {
|
||||||
IChromosome[] chromosomes = new IChromosome[genome.getChromosomes().length];
|
mate = null;
|
||||||
IChromosome[] parent1 = mutateSpecies(world, genome, mate);
|
}
|
||||||
IChromosome[] parent2 = mutateSpecies(world, mate, genome);
|
|
||||||
for (int i = 0; i < parent1.length; ++i) {
|
|
||||||
if (parent1[i] != null && parent2[i] != null) {
|
|
||||||
chromosomes[i] = Chromosome.inheritChromosome(world.rand, parent1[i], parent2[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new Flower(new FlowerGenome(chromosomes), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private IChromosome[] mutateSpecies(World world, IFlowerGenome genomeOne, IFlowerGenome genomeTwo) {
|
@Override
|
||||||
IChromosome[] parent1 = genomeOne.getChromosomes();
|
public IFlower getOffspring(World world) {
|
||||||
IChromosome[] parent2 = genomeTwo.getChromosomes();
|
IChromosome[] chromosomes = new IChromosome[genome.getChromosomes().length];
|
||||||
IAllele allele0;
|
IChromosome[] parent1 = mutateSpecies(world, genome, mate);
|
||||||
IAllele allele2;
|
IChromosome[] parent2 = mutateSpecies(world, mate, genome);
|
||||||
IFlowerGenome genome0;
|
for (int i = 0; i < parent1.length; ++i) {
|
||||||
IFlowerGenome genome2;
|
if (parent1[i] != null && parent2[i] != null) {
|
||||||
|
chromosomes[i] = Chromosome.inheritChromosome(world.rand, parent1[i], parent2[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Flower(new FlowerGenome(chromosomes), 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (world.rand.nextBoolean()) {
|
private IChromosome[] mutateSpecies(World world, IFlowerGenome genomeOne, IFlowerGenome genomeTwo) {
|
||||||
allele0 = parent1[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
IChromosome[] parent1 = genomeOne.getChromosomes();
|
||||||
allele2 = parent2[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
IChromosome[] parent2 = genomeTwo.getChromosomes();
|
||||||
genome0 = genomeOne;
|
IAllele allele0;
|
||||||
genome2 = genomeTwo;
|
IAllele allele2;
|
||||||
} else {
|
IFlowerGenome genome0;
|
||||||
allele0 = parent2[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
IFlowerGenome genome2;
|
||||||
allele2 = parent1[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
|
||||||
genome0 = genomeTwo;
|
|
||||||
genome2 = genomeOne;
|
|
||||||
}
|
|
||||||
|
|
||||||
IFlowerColor colour1 = genome0.getPrimaryColor();
|
if (world.rand.nextBoolean()) {
|
||||||
IFlowerColor colour2 = genome2.getPrimaryColor();
|
allele0 = parent1[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||||
if (colour1 != colour2) {
|
allele2 = parent2[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||||
for (IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
genome0 = genomeOne;
|
||||||
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
genome2 = genomeTwo;
|
||||||
parent1[EnumFlowerChromosome.PRIMARY.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
} else {
|
||||||
}
|
allele0 = parent2[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||||
}
|
allele2 = parent1[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||||
}
|
genome0 = genomeTwo;
|
||||||
|
genome2 = genomeOne;
|
||||||
|
}
|
||||||
|
|
||||||
colour1 = genome0.getSecondaryColor();
|
IFlowerColor colour1 = genome0.getPrimaryColor();
|
||||||
colour2 = genome2.getSecondaryColor();
|
IFlowerColor colour2 = genome2.getPrimaryColor();
|
||||||
if (colour1 != colour2) {
|
if (colour1 != colour2) {
|
||||||
for (IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
for (IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
||||||
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
||||||
parent1[EnumFlowerChromosome.SECONDARY.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
parent1[EnumFlowerChromosome.PRIMARY.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
colour1 = genome0.getStemColor();
|
colour1 = genome0.getSecondaryColor();
|
||||||
colour2 = genome2.getStemColor();
|
colour2 = genome2.getSecondaryColor();
|
||||||
if (colour1 != colour2) {
|
if (colour1 != colour2) {
|
||||||
for (IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
for (IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
||||||
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
||||||
parent1[EnumFlowerChromosome.STEM.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
parent1[EnumFlowerChromosome.SECONDARY.ordinal()] = new Chromosome(
|
||||||
}
|
mutation.getResult().getAllele());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IChromosome[] template = null;
|
colour1 = genome0.getStemColor();
|
||||||
for (IFlowerMutation mutation2 : BotanyCore.getFlowerRoot().getMutations(true)) {
|
colour2 = genome2.getStemColor();
|
||||||
float chance = mutation2.getChance(allele0, allele2, genome0, genome2);
|
if (colour1 != colour2) {
|
||||||
if (chance > 0.0f && world.rand.nextFloat() * 100.0f < chance && template == null) {
|
for (IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
||||||
template = BotanyCore.getFlowerRoot().templateAsChromosomes(mutation2.getTemplate());
|
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
||||||
}
|
parent1[EnumFlowerChromosome.STEM.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (template != null) {
|
IChromosome[] template = null;
|
||||||
parent1 = template;
|
for (IFlowerMutation mutation2 : BotanyCore.getFlowerRoot().getMutations(true)) {
|
||||||
}
|
float chance = mutation2.getChance(allele0, allele2, genome0, genome2);
|
||||||
return parent1;
|
if (chance > 0.0f && world.rand.nextFloat() * 100.0f < chance && template == null) {
|
||||||
}
|
template = BotanyCore.getFlowerRoot().templateAsChromosomes(mutation2.getTemplate());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (template != null) {
|
||||||
|
parent1 = template;
|
||||||
|
}
|
||||||
|
return parent1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.EnumAcidity;
|
||||||
import binnie.botany.api.EnumFlowerChromosome;
|
import binnie.botany.api.EnumFlowerChromosome;
|
||||||
@@ -16,115 +18,113 @@ import forestry.api.genetics.IAlleleTolerance;
|
|||||||
import forestry.api.genetics.IChromosome;
|
import forestry.api.genetics.IChromosome;
|
||||||
import forestry.api.genetics.ISpeciesRoot;
|
import forestry.api.genetics.ISpeciesRoot;
|
||||||
import forestry.core.genetics.Genome;
|
import forestry.core.genetics.Genome;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
|
|
||||||
public class FlowerGenome extends Genome implements IFlowerGenome {
|
public class FlowerGenome extends Genome implements IFlowerGenome {
|
||||||
public FlowerGenome(NBTTagCompound nbttagcompound) {
|
|
||||||
super(nbttagcompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FlowerGenome(IChromosome[] chromosomes) {
|
public FlowerGenome(NBTTagCompound nbttagcompound) {
|
||||||
super(chromosomes);
|
super(nbttagcompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public FlowerGenome(IChromosome[] chromosomes) {
|
||||||
public IAlleleFlowerSpecies getPrimary() {
|
super(chromosomes);
|
||||||
return (IAlleleFlowerSpecies) getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAlleleFlowerSpecies getSecondary() {
|
public IAlleleFlowerSpecies getPrimary() {
|
||||||
return (IAlleleFlowerSpecies) getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
return (IAlleleFlowerSpecies) getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ISpeciesRoot getSpeciesRoot() {
|
public IAlleleFlowerSpecies getSecondary() {
|
||||||
return BotanyCore.getFlowerRoot();
|
return (IAlleleFlowerSpecies) getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFlowerColor getPrimaryColor() {
|
public ISpeciesRoot getSpeciesRoot() {
|
||||||
return ((AlleleColor) getActiveAllele(EnumFlowerChromosome.PRIMARY)).getColor();
|
return BotanyCore.getFlowerRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFlowerColor getSecondaryColor() {
|
public EnumFlowerColor getPrimaryColor() {
|
||||||
return ((AlleleColor) getActiveAllele(EnumFlowerChromosome.SECONDARY)).getColor();
|
return ((AlleleColor) getActiveAllele(EnumFlowerChromosome.PRIMARY)).getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFlowerColor getStemColor() {
|
public EnumFlowerColor getSecondaryColor() {
|
||||||
return ((AlleleColor) getActiveAllele(EnumFlowerChromosome.STEM)).getColor();
|
return ((AlleleColor) getActiveAllele(EnumFlowerChromosome.SECONDARY)).getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFertility() {
|
public EnumFlowerColor getStemColor() {
|
||||||
return ((IAlleleInteger) getActiveAllele(EnumFlowerChromosome.FERTILITY)).getValue();
|
return ((AlleleColor) getActiveAllele(EnumFlowerChromosome.STEM)).getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLifespan() {
|
public int getFertility() {
|
||||||
return ((IAlleleInteger) getActiveAllele(EnumFlowerChromosome.LIFESPAN)).getValue() / 5;
|
return ((IAlleleInteger) getActiveAllele(EnumFlowerChromosome.FERTILITY)).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlowerType getType() {
|
public int getLifespan() {
|
||||||
return getPrimary().getType();
|
return ((IAlleleInteger) getActiveAllele(EnumFlowerChromosome.LIFESPAN)).getValue() / 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumTolerance getToleranceTemperature() {
|
public IFlowerType getType() {
|
||||||
return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE)).getValue();
|
return getPrimary().getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumTolerance getToleranceMoisture() {
|
public EnumTolerance getToleranceTemperature() {
|
||||||
return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.HUMIDITY_TOLERANCE)).getValue();
|
return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE)).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumTolerance getTolerancePH() {
|
public EnumTolerance getToleranceMoisture() {
|
||||||
return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.PH_TOLERANCE)).getValue();
|
return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.HUMIDITY_TOLERANCE)).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
public EnumTolerance getTolerancePH() {
|
||||||
super.readFromNBT(nbttagcompound);
|
return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.PH_TOLERANCE)).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getAgeChance() {
|
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||||
return 1.0f * (float) Math.sqrt(2.0f / getLifespan());
|
super.readFromNBT(nbttagcompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getSappiness() {
|
public float getAgeChance() {
|
||||||
return ((IAlleleFloat) getActiveAllele(EnumFlowerChromosome.SAPPINESS)).getValue();
|
return 1.0f * (float) Math.sqrt(2.0f / getLifespan());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTolerate(EnumAcidity ePH) {
|
public float getSappiness() {
|
||||||
int pH = ePH.ordinal();
|
return ((IAlleleFloat) getActiveAllele(EnumFlowerChromosome.SAPPINESS)).getValue();
|
||||||
int[] pHTol = Binnie.Genetics.getTolerance(getTolerancePH());
|
}
|
||||||
int fPH = getPrimary().getPH().ordinal();
|
|
||||||
return pH >= fPH + pHTol[0] && pH <= fPH + pHTol[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTolerate(EnumMoisture eMoisture) {
|
public boolean canTolerate(EnumAcidity ePH) {
|
||||||
int moisture = eMoisture.ordinal();
|
int pH = ePH.ordinal();
|
||||||
int[] moistTol = Binnie.Genetics.getTolerance(getToleranceMoisture());
|
int[] pHTol = Binnie.Genetics.getTolerance(getTolerancePH());
|
||||||
int fMoisture = getPrimary().getMoisture().ordinal();
|
int fPH = getPrimary().getPH().ordinal();
|
||||||
return moisture >= fMoisture + moistTol[0]
|
return pH >= fPH + pHTol[0] && pH <= fPH + pHTol[1];
|
||||||
&& moisture <= fMoisture + moistTol[1];
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTolerate(EnumTemperature eTemp) {
|
public boolean canTolerate(EnumMoisture eMoisture) {
|
||||||
int temp = eTemp.ordinal();
|
int moisture = eMoisture.ordinal();
|
||||||
int[] tempTol = Binnie.Genetics.getTolerance(getToleranceTemperature());
|
int[] moistTol = Binnie.Genetics.getTolerance(getToleranceMoisture());
|
||||||
int fTemp = getPrimary().getTemperature().ordinal();
|
int fMoisture = getPrimary().getMoisture().ordinal();
|
||||||
return temp >= fTemp + tempTol[0]
|
return moisture >= fMoisture + moistTol[0] && moisture <= fMoisture + moistTol[1];
|
||||||
&& temp <= fTemp + tempTol[1];
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public boolean canTolerate(EnumTemperature eTemp) {
|
||||||
|
int temp = eTemp.ordinal();
|
||||||
|
int[] tempTol = Binnie.Genetics.getTolerance(getToleranceTemperature());
|
||||||
|
int fTemp = getPrimary().getTemperature().ordinal();
|
||||||
|
return temp >= fTemp + tempTol[0] && temp <= fTemp + tempTol[1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,19 @@
|
|||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import binnie.botany.api.EnumFlowerChromosome;
|
import binnie.botany.api.EnumFlowerChromosome;
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
@@ -10,7 +24,6 @@ import binnie.botany.api.IFlower;
|
|||||||
import binnie.botany.api.IFlowerGenome;
|
import binnie.botany.api.IFlowerGenome;
|
||||||
import binnie.botany.api.IFlowerMutation;
|
import binnie.botany.api.IFlowerMutation;
|
||||||
import binnie.botany.api.IFlowerRoot;
|
import binnie.botany.api.IFlowerRoot;
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
import forestry.api.genetics.AlleleManager;
|
import forestry.api.genetics.AlleleManager;
|
||||||
import forestry.api.genetics.IAllele;
|
import forestry.api.genetics.IAllele;
|
||||||
import forestry.api.genetics.IChromosomeType;
|
import forestry.api.genetics.IChromosomeType;
|
||||||
@@ -18,257 +31,247 @@ import forestry.api.genetics.IIndividual;
|
|||||||
import forestry.api.genetics.IMutation;
|
import forestry.api.genetics.IMutation;
|
||||||
import forestry.api.genetics.ISpeciesType;
|
import forestry.api.genetics.ISpeciesType;
|
||||||
import forestry.core.genetics.SpeciesRoot;
|
import forestry.core.genetics.SpeciesRoot;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
|
public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
|
||||||
public static int flowerSpeciesCount = -1;
|
|
||||||
public static ArrayList<IFlower> flowerTemplates = new ArrayList<>();
|
|
||||||
|
|
||||||
protected static String UID = "rootFlowers";
|
public static int flowerSpeciesCount = -1;
|
||||||
|
public static ArrayList<IFlower> flowerTemplates = new ArrayList<>();
|
||||||
|
|
||||||
private static ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
|
protected static String UID = "rootFlowers";
|
||||||
private static ArrayList<IColourMix> colourMixes = new ArrayList<>();
|
|
||||||
|
|
||||||
protected Map<ItemStack, IFlower> conversions;
|
private static ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
|
||||||
|
private static ArrayList<IColourMix> colourMixes = new ArrayList<>();
|
||||||
|
|
||||||
public FlowerHelper() {
|
protected Map<ItemStack, IFlower> conversions;
|
||||||
conversions = new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public FlowerHelper() {
|
||||||
public String getUID() {
|
conversions = new HashMap<>();
|
||||||
return UID;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSpeciesCount() {
|
public String getUID() {
|
||||||
if (FlowerHelper.flowerSpeciesCount < 0) {
|
return UID;
|
||||||
FlowerHelper.flowerSpeciesCount = 0;
|
}
|
||||||
for (Map.Entry<String, IAllele> entry : AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet()) {
|
|
||||||
if (entry.getValue() instanceof IAlleleFlowerSpecies && ((IAlleleFlowerSpecies) entry.getValue()).isCounted()) {
|
|
||||||
FlowerHelper.flowerSpeciesCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return FlowerHelper.flowerSpeciesCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMember(ItemStack stack) {
|
public int getSpeciesCount() {
|
||||||
return stack != null
|
if (FlowerHelper.flowerSpeciesCount < 0) {
|
||||||
&& getStageType(stack) != EnumFlowerStage.NONE;
|
FlowerHelper.flowerSpeciesCount = 0;
|
||||||
}
|
for (Map.Entry<String, IAllele> entry : AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet()) {
|
||||||
|
if (entry.getValue() instanceof IAlleleFlowerSpecies
|
||||||
|
&& ((IAlleleFlowerSpecies) entry.getValue()).isCounted()) {
|
||||||
|
FlowerHelper.flowerSpeciesCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FlowerHelper.flowerSpeciesCount;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMember(ItemStack stack, int type) {
|
public boolean isMember(ItemStack stack) {
|
||||||
return getStageType(stack).ordinal() == type;
|
return stack != null && getStageType(stack) != EnumFlowerStage.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMember(IIndividual individual) {
|
public boolean isMember(ItemStack stack, int type) {
|
||||||
return individual instanceof IFlower;
|
return getStageType(stack).ordinal() == type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getMemberStack(IIndividual flower, int type) {
|
public boolean isMember(IIndividual individual) {
|
||||||
if (!isMember(flower)) {
|
return individual instanceof IFlower;
|
||||||
return null;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Item flowerItem = Botany.flowerItem;
|
@Override
|
||||||
if (type == EnumFlowerStage.SEED.ordinal()) {
|
public ItemStack getMemberStack(IIndividual flower, int type) {
|
||||||
flowerItem = Botany.seed;
|
if (!isMember(flower)) {
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (type == EnumFlowerStage.POLLEN.ordinal()) {
|
Item flowerItem = Botany.flowerItem;
|
||||||
flowerItem = Botany.pollen;
|
if (type == EnumFlowerStage.SEED.ordinal()) {
|
||||||
}
|
flowerItem = Botany.seed;
|
||||||
|
}
|
||||||
|
|
||||||
if (flowerItem != Botany.flowerItem) {
|
if (type == EnumFlowerStage.POLLEN.ordinal()) {
|
||||||
((IFlower) flower).setAge(0);
|
flowerItem = Botany.pollen;
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
if (flowerItem != Botany.flowerItem) {
|
||||||
flower.writeToNBT(nbttagcompound);
|
((IFlower) flower).setAge(0);
|
||||||
ItemStack flowerStack = new ItemStack(flowerItem);
|
}
|
||||||
flowerStack.setTagCompound(nbttagcompound);
|
|
||||||
return flowerStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
public EnumFlowerStage getStageType(ItemStack stack) {
|
flower.writeToNBT(nbttagcompound);
|
||||||
if (stack == null) {
|
ItemStack flowerStack = new ItemStack(flowerItem);
|
||||||
return EnumFlowerStage.NONE;
|
flowerStack.setTagCompound(nbttagcompound);
|
||||||
}
|
return flowerStack;
|
||||||
if (stack.getItem() == Botany.flowerItem) {
|
}
|
||||||
return EnumFlowerStage.FLOWER;
|
|
||||||
}
|
|
||||||
if (stack.getItem() == Botany.pollen) {
|
|
||||||
return EnumFlowerStage.POLLEN;
|
|
||||||
}
|
|
||||||
if (stack.getItem() == Botany.seed) {
|
|
||||||
return EnumFlowerStage.SEED;
|
|
||||||
}
|
|
||||||
return EnumFlowerStage.NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlower getMember(ItemStack stack) {
|
public EnumFlowerStage getStageType(ItemStack stack) {
|
||||||
if (!isMember(stack)) {
|
if (stack == null) {
|
||||||
return null;
|
return EnumFlowerStage.NONE;
|
||||||
}
|
}
|
||||||
return new Flower(stack.getTagCompound());
|
if (stack.getItem() == Botany.flowerItem) {
|
||||||
}
|
return EnumFlowerStage.FLOWER;
|
||||||
|
}
|
||||||
|
if (stack.getItem() == Botany.pollen) {
|
||||||
|
return EnumFlowerStage.POLLEN;
|
||||||
|
}
|
||||||
|
if (stack.getItem() == Botany.seed) {
|
||||||
|
return EnumFlowerStage.SEED;
|
||||||
|
}
|
||||||
|
return EnumFlowerStage.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlower getFlower(World world, IFlowerGenome genome) {
|
public IFlower getMember(ItemStack stack) {
|
||||||
return new Flower(genome, 2);
|
if (!isMember(stack)) {
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
return new Flower(stack.getTagCompound());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlowerGenome templateAsGenome(IAllele[] template) {
|
public IFlower getFlower(World world, IFlowerGenome genome) {
|
||||||
return new FlowerGenome(templateAsChromosomes(template));
|
return new Flower(genome, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlowerGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive) {
|
public IFlowerGenome templateAsGenome(IAllele[] template) {
|
||||||
return new FlowerGenome(templateAsChromosomes(templateActive, templateInactive));
|
return new FlowerGenome(templateAsChromosomes(template));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlower templateAsIndividual(IAllele[] template) {
|
public IFlowerGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive) {
|
||||||
return new Flower(templateAsGenome(template), 2);
|
return new FlowerGenome(templateAsChromosomes(templateActive, templateInactive));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlower templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive) {
|
public IFlower templateAsIndividual(IAllele[] template) {
|
||||||
return new Flower(templateAsGenome(templateActive, templateInactive), 2);
|
return new Flower(templateAsGenome(template), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<IFlower> getIndividualTemplates() {
|
public IFlower templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive) {
|
||||||
return FlowerHelper.flowerTemplates;
|
return new Flower(templateAsGenome(templateActive, templateInactive), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerTemplate(IAllele[] template) {
|
public ArrayList<IFlower> getIndividualTemplates() {
|
||||||
registerTemplate(template[0].getUID(), template);
|
return FlowerHelper.flowerTemplates;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerTemplate(String identifier, IAllele[] template) {
|
public void registerTemplate(IAllele[] template) {
|
||||||
FlowerHelper.flowerTemplates.add(new Flower(templateAsGenome(template), 2));
|
registerTemplate(template[0].getUID(), template);
|
||||||
if (!speciesTemplates.containsKey(identifier)) {
|
}
|
||||||
speciesTemplates.put(identifier, template);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAllele[] getTemplate(String identifier) {
|
public void registerTemplate(String identifier, IAllele[] template) {
|
||||||
return speciesTemplates.get(identifier);
|
FlowerHelper.flowerTemplates.add(new Flower(templateAsGenome(template), 2));
|
||||||
}
|
if (!speciesTemplates.containsKey(identifier)) {
|
||||||
|
speciesTemplates.put(identifier, template);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAllele[] getDefaultTemplate() {
|
public IAllele[] getTemplate(String identifier) {
|
||||||
return FlowerTemplates.getDefaultTemplate();
|
return speciesTemplates.get(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAllele[] getRandomTemplate(Random rand) {
|
public IAllele[] getDefaultTemplate() {
|
||||||
return speciesTemplates.values().toArray(new IAllele[0][])[rand.nextInt(speciesTemplates.values().size())];
|
return FlowerTemplates.getDefaultTemplate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<IFlowerMutation> getMutations(boolean shuffle) {
|
public IAllele[] getRandomTemplate(Random rand) {
|
||||||
if (shuffle) {
|
return speciesTemplates.values().toArray(new IAllele[0][])[rand.nextInt(speciesTemplates.values().size())];
|
||||||
Collections.shuffle(FlowerHelper.flowerMutations);
|
}
|
||||||
}
|
|
||||||
return FlowerHelper.flowerMutations;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMutation(IMutation mutation) {
|
public Collection<IFlowerMutation> getMutations(boolean shuffle) {
|
||||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getTemplate()[0].getUID()) ||
|
if (shuffle) {
|
||||||
AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele0().getUID()) ||
|
Collections.shuffle(FlowerHelper.flowerMutations);
|
||||||
AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele1().getUID())) {
|
}
|
||||||
return;
|
return FlowerHelper.flowerMutations;
|
||||||
}
|
}
|
||||||
FlowerHelper.flowerMutations.add((IFlowerMutation) mutation);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBotanistTracker getBreedingTracker(World world, GameProfile player) {
|
public void registerMutation(IMutation mutation) {
|
||||||
String filename = "BotanistTracker." + ((player == null) ? "common" : player.getId());
|
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getTemplate()[0].getUID())
|
||||||
BotanistTracker tracker = (BotanistTracker) world.loadItemData(BotanistTracker.class, filename);
|
|| AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele0().getUID())
|
||||||
if (tracker == null) {
|
|| AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele1().getUID())) {
|
||||||
tracker = new BotanistTracker(filename);
|
return;
|
||||||
world.setItemData(filename, tracker);
|
}
|
||||||
}
|
FlowerHelper.flowerMutations.add((IFlowerMutation) mutation);
|
||||||
return tracker;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIndividual getMember(NBTTagCompound compound) {
|
public IBotanistTracker getBreedingTracker(World world, GameProfile player) {
|
||||||
return new Flower(compound);
|
String filename = "BotanistTracker." + ((player == null) ? "common" : player.getId());
|
||||||
}
|
BotanistTracker tracker = (BotanistTracker) world.loadItemData(BotanistTracker.class, filename);
|
||||||
|
if (tracker == null) {
|
||||||
|
tracker = new BotanistTracker(filename);
|
||||||
|
world.setItemData(filename, tracker);
|
||||||
|
}
|
||||||
|
return tracker;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class getMemberClass() {
|
public IIndividual getMember(NBTTagCompound compound) {
|
||||||
return IFlower.class;
|
return new Flower(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IChromosomeType[] getKaryotype() {
|
public Class getMemberClass() {
|
||||||
return EnumFlowerChromosome.values();
|
return IFlower.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IChromosomeType getKaryotypeKey() {
|
public IChromosomeType[] getKaryotype() {
|
||||||
return EnumFlowerChromosome.SPECIES;
|
return EnumFlowerChromosome.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addConversion(ItemStack stack, IAllele[] template) {
|
public IChromosomeType getKaryotypeKey() {
|
||||||
IFlower flower = getFlower(null, templateAsGenome(template));
|
return EnumFlowerChromosome.SPECIES;
|
||||||
conversions.put(stack, flower);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlower getConversion(ItemStack stack) {
|
public void addConversion(ItemStack stack, IAllele[] template) {
|
||||||
for (Map.Entry<ItemStack, IFlower> entry : conversions.entrySet()) {
|
IFlower flower = getFlower(null, templateAsGenome(template));
|
||||||
if (entry.getKey().isItemEqual(stack)) {
|
conversions.put(stack, flower);
|
||||||
return (IFlower) entry.getValue().copy();
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerColourMix(IColourMix colorMix) {
|
public IFlower getConversion(ItemStack stack) {
|
||||||
FlowerHelper.colourMixes.add(colorMix);
|
for (Map.Entry<ItemStack, IFlower> entry : conversions.entrySet()) {
|
||||||
}
|
if (entry.getKey().isItemEqual(stack)) {
|
||||||
|
return (IFlower) entry.getValue().copy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<IColourMix> getColourMixes(boolean shuffle) {
|
public void registerColourMix(IColourMix colorMix) {
|
||||||
if (shuffle) {
|
FlowerHelper.colourMixes.add(colorMix);
|
||||||
Collections.shuffle(FlowerHelper.colourMixes);
|
}
|
||||||
}
|
|
||||||
return FlowerHelper.colourMixes;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ??
|
@Override
|
||||||
@Override
|
public Collection<IColourMix> getColourMixes(boolean shuffle) {
|
||||||
public ISpeciesType getType(ItemStack stack) {
|
if (shuffle) {
|
||||||
return null;
|
Collections.shuffle(FlowerHelper.colourMixes);
|
||||||
}
|
}
|
||||||
|
return FlowerHelper.colourMixes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ??
|
||||||
|
@Override
|
||||||
|
public ISpeciesType getType(ItemStack stack) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||||
import binnie.botany.api.IFlowerMutation;
|
import binnie.botany.api.IFlowerMutation;
|
||||||
import binnie.botany.core.BotanyCore;
|
import binnie.botany.core.BotanyCore;
|
||||||
@@ -7,79 +10,76 @@ import forestry.api.genetics.IAllele;
|
|||||||
import forestry.api.genetics.IGenome;
|
import forestry.api.genetics.IGenome;
|
||||||
import forestry.api.genetics.ISpeciesRoot;
|
import forestry.api.genetics.ISpeciesRoot;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class FlowerMutation implements IFlowerMutation {
|
public class FlowerMutation implements IFlowerMutation {
|
||||||
protected IAlleleFlowerSpecies allele0;
|
|
||||||
protected IAlleleFlowerSpecies allele1;
|
|
||||||
protected IAllele[] template;
|
|
||||||
protected int chance;
|
|
||||||
|
|
||||||
FlowerMutation(IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IAllele[] template, int chance) {
|
protected IAlleleFlowerSpecies allele0;
|
||||||
this.allele0 = allele0;
|
protected IAlleleFlowerSpecies allele1;
|
||||||
this.allele1 = allele1;
|
protected IAllele[] template;
|
||||||
this.template = template;
|
protected int chance;
|
||||||
this.chance = chance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
FlowerMutation(IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IAllele[] template, int chance) {
|
||||||
public IAlleleFlowerSpecies getAllele0() {
|
this.allele0 = allele0;
|
||||||
return allele0;
|
this.allele1 = allele1;
|
||||||
}
|
this.template = template;
|
||||||
|
this.chance = chance;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAlleleFlowerSpecies getAllele1() {
|
public IAlleleFlowerSpecies getAllele0() {
|
||||||
return allele1;
|
return allele0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAllele[] getTemplate() {
|
public IAlleleFlowerSpecies getAllele1() {
|
||||||
return template;
|
return allele1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getBaseChance() {
|
public IAllele[] getTemplate() {
|
||||||
return chance;
|
return template;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPartner(IAllele allele) {
|
public float getBaseChance() {
|
||||||
return allele.getUID().equals(allele0.getUID())
|
return chance;
|
||||||
|| allele.getUID().equals(allele1.getUID());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAllele getPartner(IAllele allele) {
|
public boolean isPartner(IAllele allele) {
|
||||||
return allele.getUID().equals(allele0.getUID()) ? allele1 : allele0;
|
return allele.getUID().equals(allele0.getUID()) || allele.getUID().equals(allele1.getUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSecret() {
|
public IAllele getPartner(IAllele allele) {
|
||||||
return false;
|
return allele.getUID().equals(allele0.getUID()) ? allele1 : allele0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getChance(IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
public boolean isSecret() {
|
||||||
if (allele0 == null || allele1 == null) {
|
return false;
|
||||||
return 0.0f;
|
}
|
||||||
}
|
|
||||||
if (this.allele0.getUID().equals(allele0.getUID()) && this.allele1.getUID().equals(allele1.getUID())) {
|
|
||||||
return getBaseChance();
|
|
||||||
}
|
|
||||||
if (this.allele1.getUID().equals(allele0.getUID()) && this.allele0.getUID().equals(allele1.getUID())) {
|
|
||||||
return getBaseChance();
|
|
||||||
}
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ISpeciesRoot getRoot() {
|
public float getChance(IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||||
return BotanyCore.getFlowerRoot();
|
if (allele0 == null || allele1 == null) {
|
||||||
}
|
return 0.0f;
|
||||||
|
}
|
||||||
|
if (this.allele0.getUID().equals(allele0.getUID()) && this.allele1.getUID().equals(allele1.getUID())) {
|
||||||
|
return getBaseChance();
|
||||||
|
}
|
||||||
|
if (this.allele1.getUID().equals(allele0.getUID()) && this.allele0.getUID().equals(allele1.getUID())) {
|
||||||
|
return getBaseChance();
|
||||||
|
}
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<String> getSpecialConditions() {
|
public ISpeciesRoot getRoot() {
|
||||||
return new ArrayList<>();
|
return BotanyCore.getFlowerRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<String> getSpecialConditions() {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -7,20 +7,21 @@ import forestry.api.genetics.IAllele;
|
|||||||
import forestry.core.genetics.alleles.EnumAllele;
|
import forestry.core.genetics.alleles.EnumAllele;
|
||||||
|
|
||||||
public class FlowerTemplates {
|
public class FlowerTemplates {
|
||||||
public static IAllele[] getDefaultTemplate() {
|
|
||||||
IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length];
|
public static IAllele[] getDefaultTemplate() {
|
||||||
alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.POPPY;
|
IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length];
|
||||||
alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.POPPY;
|
||||||
alleles[EnumFlowerChromosome.SECONDARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
||||||
alleles[EnumFlowerChromosome.FERTILITY.ordinal()] = AlleleHelper.getAllele(EnumAllele.Fertility.NORMAL);
|
alleles[EnumFlowerChromosome.SECONDARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
||||||
alleles[EnumFlowerChromosome.TERRITORY.ordinal()] = AlleleHelper.getAllele(EnumAllele.Territory.AVERAGE);
|
alleles[EnumFlowerChromosome.FERTILITY.ordinal()] = AlleleHelper.getAllele(EnumAllele.Fertility.NORMAL);
|
||||||
alleles[EnumFlowerChromosome.EFFECT.ordinal()] = ModuleGenetics.alleleEffectNone;
|
alleles[EnumFlowerChromosome.TERRITORY.ordinal()] = AlleleHelper.getAllele(EnumAllele.Territory.AVERAGE);
|
||||||
alleles[EnumFlowerChromosome.LIFESPAN.ordinal()] = AlleleHelper.getAllele(EnumAllele.Lifespan.NORMAL);
|
alleles[EnumFlowerChromosome.EFFECT.ordinal()] = ModuleGenetics.alleleEffectNone;
|
||||||
alleles[EnumFlowerChromosome.TEMPERATURE_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
alleles[EnumFlowerChromosome.LIFESPAN.ordinal()] = AlleleHelper.getAllele(EnumAllele.Lifespan.NORMAL);
|
||||||
alleles[EnumFlowerChromosome.HUMIDITY_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
alleles[EnumFlowerChromosome.TEMPERATURE_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
||||||
alleles[EnumFlowerChromosome.PH_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
alleles[EnumFlowerChromosome.HUMIDITY_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
||||||
alleles[EnumFlowerChromosome.SAPPINESS.ordinal()] = AlleleHelper.getAllele(EnumAllele.Sappiness.AVERAGE);
|
alleles[EnumFlowerChromosome.PH_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
||||||
alleles[EnumFlowerChromosome.STEM.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.GREEN);
|
alleles[EnumFlowerChromosome.SAPPINESS.ordinal()] = AlleleHelper.getAllele(EnumAllele.Sappiness.AVERAGE);
|
||||||
return alleles;
|
alleles[EnumFlowerChromosome.STEM.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.GREEN);
|
||||||
}
|
return alleles;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,7 @@
|
|||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import java.util.List;
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import binnie.botany.core.BotanyGUI;
|
|
||||||
import binnie.core.util.I18N;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -14,54 +10,59 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.List;
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.CreativeTabBotany;
|
||||||
|
import binnie.botany.core.BotanyGUI;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class ItemDictionary extends Item {
|
public class ItemDictionary extends Item {
|
||||||
protected IIcon iconMaster;
|
|
||||||
|
|
||||||
public ItemDictionary() {
|
protected IIcon iconMaster;
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
setUnlocalizedName("database");
|
|
||||||
setMaxStackSize(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ItemDictionary() {
|
||||||
@SideOnly(Side.CLIENT)
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
public void registerIcons(IIconRegister register) {
|
setUnlocalizedName("database");
|
||||||
itemIcon = Botany.proxy.getIcon(register, "botanistDatabase");
|
setMaxStackSize(1);
|
||||||
iconMaster = Botany.proxy.getIcon(register, "masterBotanistDatabase");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIconFromDamage(int damage) {
|
public void registerIcons(IIconRegister register) {
|
||||||
return (damage == 0) ? itemIcon : iconMaster;
|
itemIcon = Botany.proxy.getIcon(register, "botanistDatabase");
|
||||||
}
|
iconMaster = Botany.proxy.getIcon(register, "masterBotanistDatabase");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
public IIcon getIconFromDamage(int damage) {
|
||||||
super.addInformation(stack, player, tooltip, advanced);
|
return (damage == 0) ? itemIcon : iconMaster;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||||
super.getSubItems(item, tab, list);
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
list.add(new ItemStack(item, 1, 1));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
@SideOnly(Side.CLIENT)
|
||||||
BotanyGUI guiId = (stack.getItemDamage() == 0) ? BotanyGUI.Database : BotanyGUI.DatabaseNEI;
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
Botany.proxy.openGui(guiId, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
super.getSubItems(item, tab, list);
|
||||||
return stack;
|
list.add(new ItemStack(item, 1, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(ItemStack stack) {
|
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||||
return (stack.getItemDamage() == 0)
|
BotanyGUI guiId = (stack.getItemDamage() == 0) ? BotanyGUI.Database : BotanyGUI.DatabaseNEI;
|
||||||
? I18N.localise("botany.item.database.0.name")
|
Botany.proxy.openGui(guiId, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||||
: I18N.localise("botany.item.database.1.name");
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
|
return (stack.getItemDamage() == 0) ? I18N.localise("botany.item.database.0.name")
|
||||||
|
: I18N.localise("botany.item.database.1.name");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import binnie.botany.core.BotanyCore;
|
import binnie.botany.core.BotanyCore;
|
||||||
@@ -17,61 +21,66 @@ import forestry.api.apiculture.FlowerManager;
|
|||||||
import forestry.api.genetics.AlleleManager;
|
import forestry.api.genetics.AlleleManager;
|
||||||
import forestry.api.genetics.IAllele;
|
import forestry.api.genetics.IAllele;
|
||||||
import forestry.api.recipes.RecipeManagers;
|
import forestry.api.recipes.RecipeManagers;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public class ModuleGenetics implements IInitializable {
|
public class ModuleGenetics implements IInitializable {
|
||||||
static AlleleEffectNone alleleEffectNone = new AlleleEffectNone();
|
|
||||||
|
|
||||||
@Override
|
static AlleleEffectNone alleleEffectNone = new AlleleEffectNone();
|
||||||
public void preInit() {
|
|
||||||
EnumFlowerColor.setupMutations();
|
|
||||||
Botany.flower = new BlockFlower();
|
|
||||||
Botany.flowerItem = new ItemFlower();
|
|
||||||
Botany.pollen = new ItemPollen();
|
|
||||||
Botany.seed = new ItemSeed();
|
|
||||||
AlleleManager.alleleRegistry.registerSpeciesRoot(BotanyCore.speciesRoot);
|
|
||||||
AlleleManager.alleleRegistry.registerAllele(ModuleGenetics.alleleEffectNone);
|
|
||||||
GameRegistry.registerBlock(Botany.flower, "flower");
|
|
||||||
BinnieCore.proxy.registerTileEntity(TileEntityFlower.class, "botany.tile.flower", null);
|
|
||||||
Botany.database = new ItemDictionary();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void preInit() {
|
||||||
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
EnumFlowerColor.setupMutations();
|
||||||
AlleleManager.alleleRegistry.registerAllele(color.getAllele());
|
Botany.flower = new BlockFlower();
|
||||||
}
|
Botany.flowerItem = new ItemFlower();
|
||||||
|
Botany.pollen = new ItemPollen();
|
||||||
|
Botany.seed = new ItemSeed();
|
||||||
|
AlleleManager.alleleRegistry.registerSpeciesRoot(BotanyCore.speciesRoot);
|
||||||
|
AlleleManager.alleleRegistry.registerAllele(ModuleGenetics.alleleEffectNone);
|
||||||
|
GameRegistry.registerBlock(Botany.flower, "flower");
|
||||||
|
BinnieCore.proxy.registerTileEntity(TileEntityFlower.class, "botany.tile.flower", null);
|
||||||
|
Botany.database = new ItemDictionary();
|
||||||
|
}
|
||||||
|
|
||||||
FlowerSpecies.setupVariants();
|
@Override
|
||||||
for (FlowerSpecies species : FlowerSpecies.values()) {
|
public void init() {
|
||||||
AlleleManager.alleleRegistry.registerAllele(species);
|
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||||
BotanyCore.getFlowerRoot().registerTemplate(species.getUID(), species.getTemplate());
|
AlleleManager.alleleRegistry.registerAllele(color.getAllele());
|
||||||
for (IAllele[] variant : species.getVariants()) {
|
}
|
||||||
BotanyCore.getFlowerRoot().registerTemplate(variant);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RendererBotany.renderID = RenderingRegistry.getNextAvailableRenderId();
|
FlowerSpecies.setupVariants();
|
||||||
BinnieCore.proxy.registerBlockRenderer(new RendererBotany());
|
for (FlowerSpecies species : FlowerSpecies.values()) {
|
||||||
}
|
AlleleManager.alleleRegistry.registerAllele(species);
|
||||||
|
BotanyCore.getFlowerRoot().registerTemplate(species.getUID(), species.getTemplate());
|
||||||
|
for (IAllele[] variant : species.getVariants()) {
|
||||||
|
BotanyCore.getFlowerRoot().registerTemplate(variant);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
RendererBotany.renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||||
public void postInit() {
|
BinnieCore.proxy.registerBlockRenderer(new RendererBotany());
|
||||||
FlowerManager.flowerRegistry.registerAcceptableFlower(Botany.flower, "flowersVanilla");
|
}
|
||||||
RecipeManagers.carpenterManager.addRecipe(
|
|
||||||
100,
|
@Override
|
||||||
Binnie.Liquid.getLiquidStack("water", 2000),
|
public void postInit() {
|
||||||
null,
|
FlowerManager.flowerRegistry.registerAcceptableFlower(Botany.flower, "flowersVanilla");
|
||||||
new ItemStack(Botany.database),
|
RecipeManagers.carpenterManager.addRecipe(
|
||||||
"X#X", "YEY", "RDR",
|
100,
|
||||||
'#', Blocks.glass_pane,
|
Binnie.Liquid.getLiquidStack("water", 2000),
|
||||||
'X', Items.gold_ingot,
|
null,
|
||||||
'Y', Items.gold_nugget,
|
new ItemStack(Botany.database),
|
||||||
'R', Items.redstone,
|
"X#X",
|
||||||
'D', Items.diamond,
|
"YEY",
|
||||||
'E', Items.emerald
|
"RDR",
|
||||||
);
|
'#',
|
||||||
}
|
Blocks.glass_pane,
|
||||||
|
'X',
|
||||||
|
Items.gold_ingot,
|
||||||
|
'Y',
|
||||||
|
Items.gold_nugget,
|
||||||
|
'R',
|
||||||
|
Items.redstone,
|
||||||
|
'D',
|
||||||
|
Items.diamond,
|
||||||
|
'E',
|
||||||
|
Items.emerald);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,60 +1,62 @@
|
|||||||
package binnie.botany.items;
|
package binnie.botany.items;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import java.util.List;
|
||||||
import binnie.core.item.IItemMisc;
|
|
||||||
import binnie.core.util.I18N;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
import java.util.List;
|
import binnie.botany.Botany;
|
||||||
|
import binnie.core.item.IItemMisc;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
public enum BotanyItems implements IItemMisc {
|
public enum BotanyItems implements IItemMisc {
|
||||||
AshPowder("powderAsh"),
|
|
||||||
PulpPowder("powderPulp"),
|
|
||||||
MulchPowder("powderMulch"),
|
|
||||||
SulphurPowder("powderSulphur"),
|
|
||||||
FertiliserPowder("powderFertiliser"),
|
|
||||||
CompostPowder("powderCompost"),
|
|
||||||
Mortar("mortar"),
|
|
||||||
Weedkiller("weedkiller");
|
|
||||||
|
|
||||||
protected IIcon icon;
|
AshPowder("powderAsh"),
|
||||||
protected String name;
|
PulpPowder("powderPulp"),
|
||||||
protected String iconPath;
|
MulchPowder("powderMulch"),
|
||||||
|
SulphurPowder("powderSulphur"),
|
||||||
|
FertiliserPowder("powderFertiliser"),
|
||||||
|
CompostPowder("powderCompost"),
|
||||||
|
Mortar("mortar"),
|
||||||
|
Weedkiller("weedkiller");
|
||||||
|
|
||||||
BotanyItems(String name) {
|
protected IIcon icon;
|
||||||
this.name = name;
|
protected String name;
|
||||||
this.iconPath = name;
|
protected String iconPath;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
BotanyItems(String name) {
|
||||||
public IIcon getIcon(ItemStack itemStack) {
|
this.name = name;
|
||||||
return icon;
|
this.iconPath = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerIcons(IIconRegister register) {
|
public IIcon getIcon(ItemStack itemStack) {
|
||||||
icon = Botany.proxy.getIcon(register, iconPath);
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(List data) {
|
public void registerIcons(IIconRegister register) {
|
||||||
// ignored
|
icon = Botany.proxy.getIcon(register, iconPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName(ItemStack itemStack) {
|
public void addInformation(List data) {
|
||||||
return I18N.localise("botany.item." + name + ".name");
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack get(int count) {
|
public String getName(ItemStack itemStack) {
|
||||||
return new ItemStack(Botany.misc, count, ordinal());
|
return I18N.localise("botany.item." + name + ".name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isActive() {
|
public ItemStack get(int count) {
|
||||||
return true;
|
return new ItemStack(Botany.misc, count, ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isActive() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,7 @@
|
|||||||
package binnie.botany.items;
|
package binnie.botany.items;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import java.util.List;
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
|
||||||
import binnie.core.util.I18N;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -13,44 +9,50 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
|
||||||
import java.util.List;
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.CreativeTabBotany;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class ItemClay extends Item {
|
public class ItemClay extends Item {
|
||||||
public ItemClay() {
|
|
||||||
setUnlocalizedName("clay");
|
|
||||||
setHasSubtypes(true);
|
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ItemClay() {
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
setUnlocalizedName("clay");
|
||||||
super.addInformation(stack, player, tooltip, advanced);
|
setHasSubtypes(true);
|
||||||
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(stack.getItemDamage()).getName());
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||||
public int getColorFromItemStack(ItemStack stack, int index) {
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
int damage = stack.getItemDamage();
|
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(stack.getItemDamage()).getName());
|
||||||
return EnumFlowerColor.get(damage).getColor(false);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(ItemStack stack) {
|
@SideOnly(Side.CLIENT)
|
||||||
return I18N.localise("botany.item.clay.name");
|
public int getColorFromItemStack(ItemStack stack, int index) {
|
||||||
}
|
int damage = stack.getItemDamage();
|
||||||
|
return EnumFlowerColor.get(damage).getColor(false);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
return I18N.localise("botany.item.clay.name");
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
}
|
||||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(IIconRegister register) {
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
itemIcon = Botany.proxy.getIcon(register, "clay");
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
}
|
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void registerIcons(IIconRegister register) {
|
||||||
|
itemIcon = Botany.proxy.getIcon(register, "clay");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,7 @@
|
|||||||
package binnie.botany.items;
|
package binnie.botany.items;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import java.util.List;
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
|
||||||
import binnie.core.util.I18N;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -13,44 +9,50 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
|
||||||
import java.util.List;
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.CreativeTabBotany;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class ItemPigment extends Item {
|
public class ItemPigment extends Item {
|
||||||
public ItemPigment() {
|
|
||||||
setUnlocalizedName("pigment");
|
|
||||||
setHasSubtypes(true);
|
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ItemPigment() {
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
setUnlocalizedName("pigment");
|
||||||
super.addInformation(stack, player, tooltip, advanced);
|
setHasSubtypes(true);
|
||||||
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(stack.getItemDamage()).getName());
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||||
public int getColorFromItemStack(ItemStack stack, int index) {
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
int damage = stack.getItemDamage();
|
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(stack.getItemDamage()).getName());
|
||||||
return EnumFlowerColor.get(damage).getColor(false);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(ItemStack stack) {
|
@SideOnly(Side.CLIENT)
|
||||||
return I18N.localise("botany.item.pigment.name");
|
public int getColorFromItemStack(ItemStack stack, int index) {
|
||||||
}
|
int damage = stack.getItemDamage();
|
||||||
|
return EnumFlowerColor.get(damage).getColor(false);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
return I18N.localise("botany.item.pigment.name");
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
}
|
||||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(IIconRegister register) {
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
itemIcon = Botany.proxy.getIcon(register, "pigment");
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
}
|
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void registerIcons(IIconRegister register) {
|
||||||
|
itemIcon = Botany.proxy.getIcon(register, "pigment");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package binnie.botany.network;
|
package binnie.botany.network;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import binnie.botany.flower.TileEntityFlower;
|
import binnie.botany.flower.TileEntityFlower;
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
import binnie.botany.genetics.EnumFlowerType;
|
import binnie.botany.genetics.EnumFlowerType;
|
||||||
@@ -7,44 +9,43 @@ import binnie.core.network.packet.MessageBinnie;
|
|||||||
import binnie.core.network.packet.MessageCoordinates;
|
import binnie.core.network.packet.MessageCoordinates;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class MessageFlowerUpdate extends MessageCoordinates {
|
public class MessageFlowerUpdate extends MessageCoordinates {
|
||||||
public TileEntityFlower.RenderInfo render;
|
|
||||||
|
|
||||||
public MessageFlowerUpdate(int posX, int posY, int posZ, TileEntityFlower.RenderInfo render) {
|
public TileEntityFlower.RenderInfo render;
|
||||||
super(PacketID.FlowerUpdate.ordinal(), posX, posY, posZ);
|
|
||||||
this.render = render;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MessageFlowerUpdate(MessageBinnie message) {
|
public MessageFlowerUpdate(int posX, int posY, int posZ, TileEntityFlower.RenderInfo render) {
|
||||||
super(message);
|
super(PacketID.FlowerUpdate.ordinal(), posX, posY, posZ);
|
||||||
}
|
this.render = render;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
public MessageFlowerUpdate(MessageBinnie message) {
|
||||||
public void writeData(ByteBuf data) throws IOException {
|
super(message);
|
||||||
super.writeData(data);
|
}
|
||||||
data.writeByte(render.primary.getID());
|
|
||||||
data.writeByte(render.secondary.getID());
|
|
||||||
data.writeByte(render.stem.getID());
|
|
||||||
data.writeByte(render.type.ordinal());
|
|
||||||
data.writeByte(render.age);
|
|
||||||
data.writeByte(render.section);
|
|
||||||
data.writeBoolean(render.wilted);
|
|
||||||
data.writeBoolean(render.flowered);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readData(ByteBuf data) throws IOException {
|
public void writeData(ByteBuf data) throws IOException {
|
||||||
super.readData(data);
|
super.writeData(data);
|
||||||
render = new TileEntityFlower.RenderInfo();
|
data.writeByte(render.primary.getID());
|
||||||
render.primary = EnumFlowerColor.values()[data.readByte()];
|
data.writeByte(render.secondary.getID());
|
||||||
render.secondary = EnumFlowerColor.values()[data.readByte()];
|
data.writeByte(render.stem.getID());
|
||||||
render.stem = EnumFlowerColor.values()[data.readByte()];
|
data.writeByte(render.type.ordinal());
|
||||||
render.type = EnumFlowerType.values()[data.readByte()];
|
data.writeByte(render.age);
|
||||||
render.age = data.readByte();
|
data.writeByte(render.section);
|
||||||
render.section = data.readByte();
|
data.writeBoolean(render.wilted);
|
||||||
render.wilted = data.readBoolean();
|
data.writeBoolean(render.flowered);
|
||||||
render.flowered = data.readBoolean();
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public void readData(ByteBuf data) throws IOException {
|
||||||
|
super.readData(data);
|
||||||
|
render = new TileEntityFlower.RenderInfo();
|
||||||
|
render.primary = EnumFlowerColor.values()[data.readByte()];
|
||||||
|
render.secondary = EnumFlowerColor.values()[data.readByte()];
|
||||||
|
render.stem = EnumFlowerColor.values()[data.readByte()];
|
||||||
|
render.type = EnumFlowerType.values()[data.readByte()];
|
||||||
|
render.age = data.readByte();
|
||||||
|
render.section = data.readByte();
|
||||||
|
render.wilted = data.readBoolean();
|
||||||
|
render.flowered = data.readBoolean();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
package binnie.botany.network;
|
package binnie.botany.network;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.ChatComponentText;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
|
|
||||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||||
import binnie.botany.flower.TileEntityFlower;
|
import binnie.botany.flower.TileEntityFlower;
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
@@ -10,81 +16,79 @@ import binnie.core.network.packet.MessageNBT;
|
|||||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import forestry.api.genetics.AlleleManager;
|
import forestry.api.genetics.AlleleManager;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.ChatComponentText;
|
|
||||||
import net.minecraft.util.IChatComponent;
|
|
||||||
|
|
||||||
public enum PacketID implements IPacketID {
|
public enum PacketID implements IPacketID {
|
||||||
FieldKit,
|
|
||||||
FlowerUpdate;
|
|
||||||
|
|
||||||
@Override
|
FieldKit,
|
||||||
public void onMessage(MessageBinnie message, MessageContext context) {
|
FlowerUpdate;
|
||||||
if (this == PacketID.FieldKit && context.side == Side.CLIENT) {
|
|
||||||
onFieldKitPacket(message);
|
|
||||||
} else if (this == PacketID.FlowerUpdate) {
|
|
||||||
onFlowerUpdatePacket(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onFlowerUpdatePacket(MessageBinnie message) {
|
@Override
|
||||||
MessageFlowerUpdate packet = new MessageFlowerUpdate(message);
|
public void onMessage(MessageBinnie message, MessageContext context) {
|
||||||
TileEntity tile = packet.getTileEntity(BinnieCore.proxy.getWorld());
|
if (this == PacketID.FieldKit && context.side == Side.CLIENT) {
|
||||||
if (tile instanceof TileEntityFlower) {
|
onFieldKitPacket(message);
|
||||||
((TileEntityFlower) tile).setRender(packet.render);
|
} else if (this == PacketID.FlowerUpdate) {
|
||||||
}
|
onFlowerUpdatePacket(message);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void onFieldKitPacket(MessageBinnie message) {
|
private void onFlowerUpdatePacket(MessageBinnie message) {
|
||||||
MessageNBT packet = new MessageNBT(message);
|
MessageFlowerUpdate packet = new MessageFlowerUpdate(message);
|
||||||
NBTTagCompound data = packet.getTagCompound();
|
TileEntity tile = packet.getTileEntity(BinnieCore.proxy.getWorld());
|
||||||
EntityPlayer player = BinnieCore.proxy.getPlayer();
|
if (tile instanceof TileEntityFlower) {
|
||||||
String info = "";
|
((TileEntityFlower) tile).setRender(packet.render);
|
||||||
if (data.hasNoTags()) {
|
}
|
||||||
info += "Flower has not been discovered by you. Breed this flower yourself to discover.";
|
}
|
||||||
} else {
|
|
||||||
IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species"));
|
|
||||||
IAlleleFlowerSpecies secondary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species2"));
|
|
||||||
float age = data.getFloat("Age");
|
|
||||||
EnumFlowerColor color1 = EnumFlowerColor.get(data.getShort("Colour"));
|
|
||||||
EnumFlowerColor color2 = EnumFlowerColor.get(data.getShort("Colour2"));
|
|
||||||
if (primary == null || secondary == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
info += "A";
|
private void onFieldKitPacket(MessageBinnie message) {
|
||||||
if (age == 0.0f) {
|
MessageNBT packet = new MessageNBT(message);
|
||||||
info += "";
|
NBTTagCompound data = packet.getTagCompound();
|
||||||
} else if (age < 0.25f) {
|
EntityPlayer player = BinnieCore.proxy.getPlayer();
|
||||||
info += " Young";
|
String info = "";
|
||||||
} else if (age < 0.75f) {
|
if (data.hasNoTags()) {
|
||||||
info += " Mature";
|
info += "Flower has not been discovered by you. Breed this flower yourself to discover.";
|
||||||
} else {
|
} else {
|
||||||
info += " Old";
|
IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry
|
||||||
}
|
.getAllele(data.getString("Species"));
|
||||||
|
IAlleleFlowerSpecies secondary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry
|
||||||
|
.getAllele(data.getString("Species2"));
|
||||||
|
float age = data.getFloat("Age");
|
||||||
|
EnumFlowerColor color1 = EnumFlowerColor.get(data.getShort("Colour"));
|
||||||
|
EnumFlowerColor color2 = EnumFlowerColor.get(data.getShort("Colour2"));
|
||||||
|
if (primary == null || secondary == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (color1 == color2) {
|
info += "A";
|
||||||
info = info + " " + color1.getName();
|
if (age == 0.0f) {
|
||||||
} else {
|
info += "";
|
||||||
info = info + " " + color1.getName() + " & " + color2.getName();
|
} else if (age < 0.25f) {
|
||||||
}
|
info += " Young";
|
||||||
|
} else if (age < 0.75f) {
|
||||||
|
info += " Mature";
|
||||||
|
} else {
|
||||||
|
info += " Old";
|
||||||
|
}
|
||||||
|
|
||||||
if (primary == secondary) {
|
if (color1 == color2) {
|
||||||
info = info + " " + primary.getName();
|
info = info + " " + color1.getName();
|
||||||
} else {
|
} else {
|
||||||
info = info + " " + primary.getName() + "-" + secondary.getName() + " Hybrid";
|
info = info + " " + color1.getName() + " & " + color2.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (age == 0.0f) {
|
if (primary == secondary) {
|
||||||
info += " Germling";
|
info = info + " " + primary.getName();
|
||||||
}
|
} else {
|
||||||
if (data.getBoolean("Wilting")) {
|
info = info + " " + primary.getName() + "-" + secondary.getName() + " Hybrid";
|
||||||
info += ". Shame it is Wilting!";
|
}
|
||||||
}
|
|
||||||
}
|
if (age == 0.0f) {
|
||||||
IChatComponent chat = new ChatComponentText(info);
|
info += " Germling";
|
||||||
player.addChatMessage(chat);
|
}
|
||||||
}
|
if (data.getBoolean("Wilting")) {
|
||||||
|
info += ". Shame it is Wilting!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IChatComponent chat = new ChatComponentText(info);
|
||||||
|
player.addChatMessage(chat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,8 @@ import binnie.botany.Botany;
|
|||||||
import binnie.core.proxy.BinnieModProxy;
|
import binnie.core.proxy.BinnieModProxy;
|
||||||
|
|
||||||
public class Proxy extends BinnieModProxy implements IBotanyProxy {
|
public class Proxy extends BinnieModProxy implements IBotanyProxy {
|
||||||
public Proxy() {
|
|
||||||
super(Botany.instance);
|
public Proxy() {
|
||||||
}
|
super(Botany.instance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loaded 100 of 851 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user