moved 1.11 to kfc

This commit is contained in:
Mohammad-Ali Minaie
2017-06-25 22:49:46 -04:00
parent e86fa3f518
commit 3928deeb7b
1334 changed files with 0 additions and 11872 deletions

50
kfc/.gitignore vendored Normal file
View File

@@ -0,0 +1,50 @@
MinecraftForge-*
Paulscode*
forge-*-changelog.txt
*-fml.txt
.gradle
build/
run/
out/
tmp/
bin/
crash-reports
config/
saves/
logs
usercache.json
usernamecache.json
options.txt
screenshots/
world/
mods/
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project
# idea
out
*.ipr
*.iws
*.iml
.idea
# gradle
build
.gradle
# other
eclipse
run
# ---> OSX
.DS_Store
.AppleDouble
.LSOverride
Icon
._*

483
kfc/LICENSE-new.txt Normal file
View File

@@ -0,0 +1,483 @@
Minecraft Forge is licensed under the terms of the LGPL 2.1 found
here http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt and copied
below.
A note on authorship:
All source artifacts are property of their original author, with
the exclusion of the contents of the patches directory and others
copied from it from time to time. Authorship of the contents of
the patches directory is retained by the Minecraft Forge project.
This is because the patches are partially machine generated
artifacts, and are changed heavily due to the way forge works.
Individual attribution within them is impossible.
Consent:
All contributions to Forge must consent to the release of any
patch content to the Forge project.
A note on infectivity:
The LGPL is chosen specifically so that projects may depend on Forge
features without being infected with its license. That is the
purpose of the LGPL. Mods and others using this code via ordinary
Java mechanics for referencing libraries are specifically not bound
by Forge's license for the Mod code.
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS

181
kfc/To-Dos.md Normal file
View File

@@ -0,0 +1,181 @@
To-Dos
*** Bugs ***
*** Current Feature ***
- [x] BlockBreaker Support for copper dust and tin dust
- [x] picking up raw bronze crucible returns some other shit
- [x] Tool breaking should return tool head
*** Feature Musket ***
- [ ] Create powder charge item (copper, charcoal, gunpowder)
- [ ] Create musket round item (lead or iron nugget)
- [ ] Create wadding item (paper)
- [ ] Create soaked slow match item (cordage, bucket of water, gunpowder)
- [ ] Create dried slow match (soaked wick on drying rack)
- [ ] Create lit slow match (dried slow match and firebow/torch/flint&steel)
- [ ] Create barrel item
- [ ] Create stock item
- [ ] Create lock assembly item
*** Backlog ***
- [ ] Move Ingot break into chunks logic out of the block and into the ForgeHammer
- [ ] Add Iron Ring Recipe
- [ ] Add chainmail recipe
- [ ] Add Iron Shield
- [ ] Gold Smelting
- [ ] Create a method which adds the types of NBT upgrades and creates a unique float instead of using magic numbers
- [ ] Add forgehammer to oreDict
- [ ] WeaponHead recipes
*** Tid-Bits ***
sed -i -- 's/iron/steel/g' *
rm *.json--
rename s/iron/steel/ iron*
*** Completed ***
- [x] Casting Table
- [x] Block
- [x] Gui
- [x] Crafting recipes
- [x] StoneTongs for all tool heads
- [x] ItemNBT
- [x] ItemRender
- [x] JSON
- [x] Change how bloomery does recipe cookTime
- [x] Duplication Bug for Tool Repair
- [x] Fix Breaker Render to rotate correctly
- [x] Make All Accompanying Recipes
- [x] Update blockstates with:
- [x] cleanIron
- [x] steel
- [x] wootz
- [x] Make an Iron Anvil
- [x] Check Iron Anvil creation logic
- [x] Make New Ore Tool, Tool Part, Ingot, and Chunk Assets
- [x] Make Steel Recipes and Tools
- [x] Make Wootz Recipes and Tools
- [x] Update tool parts and tool textures
- [x] Light Forge and Firebox with Firebow or Torch
- [x] Any gallagher can be used to make a stone anvil
- [x] Update Crafting for tools to include leatherStrap
- [x] Forge Setting Player on fire but not taking damage
- [x] Forge and Bloomery make Smoke
- [x] Remove cool ingots from inventories with Hand
- [x] Remove cool tools heads from inventories with Hand
- [x] Add rendering in anvil renderer for Cool Ingots
- [x] Hot Ingots should cool down
- [x] Coal is not being removed from the forge or firebox
- [x] Tool Disassembly
- [x] Tool Repair
- [x] Custom Tool Material
- [x] Can't remove fuel from Bloomery
- [x] Crafting Recipe for Iron Ingot to Iron Ball
- [x] Block To Read Temperature
- [x] Bellows Moves Faster
- [x] Create the hoe Item
- [x] Finish Toolhead Recipes
- [x] Add randomInt to anvil
- [x] Create the axe Item
- [x] Create the shovel Item
- [x] Create the axe Model
- [x] Create the shovel model
- [x] Create the hoe model
- [x] Fix Flame creator from Forge and Bloomery
- [x] Copy Heat Handler for Forge to Bloomery
- [x] Create getter and setter for itemNBT
- [x] Create all the textures for all the NBT types
- [x] Check for if the pickaxe head is hot before removing from forge
- [x] fix rotation rendering for Anvil
- [x] Fix renderings in the Anvil
- [x] Fix Renderings in the Forge
- [x] Fix StoneTongs rendering for NBT 8
- [x] Allow redstone, lapis, and shards in the anvil
- [x] Create toolHead Item
- [x] Give toolHead item NBT
- [x] Create pickaxehead Item
- [x] Create pickaxehead SubNBTs
- [x] Create Forging Recipe for toolHeads
- [x] Create Anvil recipe for toolHeads
- [x] Create Slot for Forge to accept toolheads in slot 4
- [x] Stone Anvil
- [x] Stone Anvil Inventory
- [x] Stone Anvil Tile
- [x] Stone Anvil Crafting
- [x] TESR Inventory Rendering for Anvil
- [x] Iron Chunk Item Model
- [x] Anvil Item Model
- [x] StoneTongs Iron Chunks
- [x] Hammer Crafting
- [x] Iron Chunking
- [x] Forge Recipe Handler
- [x] Hot Iron Ingot Recipe
- [x] Block Drop for failed crucible
- [x] oreDictionary ingotBall to ingotIron
- [x] Tile Firebox Heat Manager
- [x] Fix Bloomery Lit Texture
- [x] Bellows break texture
- [x] Bellows Pump Speed
- [x] Break IronCrucible gives back Ore
- [x] Tile Bloomery Heat Manager
- [x] Tongs Model for hotIron
- [x] Tongs Model for hotIronCooked
- [x] Tongs Model for hotIronBurnt
- [x] Tongs Extract from bloomery for Hot Iron
- [x] Tongs Extract from bloomery for Hot Iron Finished
- [x] Crafting Recipes
0 | Default StoneTongs
1 | Empty Crucible Hot
2 | Empty Crucible Cracked Hot
================================
3 | Hot Iron Crucible
4 | Hot Cooked Iron Crucible
5 | Hot Failed Iron Crucible
6 | Hot Iron Ingot
7 | Hot Iron Chunk
--------------------------------
8 | Hot Iron Pickaxe Head
9 | Hot Iron Axe Head
10 | Hot Iron Shovel Head
11 | Hot Iron Hoe Head
================================
12 | Hot Clean Iron Crucible
13 | Hot Cooked Clean Iron Crucible
14 | Hot Failed Clean Iron Crucible
15 | Hot Clean Iron Ball
16 | Hot Clean Iron Chunk
--------------------------------
17 | Hot Clean Iron Pickaxe Head
18 | Hot Clean Iron Axe Head
19 | Hot Clean Iron Shovel Head
20 | Hot Clean Iron Hoe Head
================================
21 | Hot Steel Crucible
22 | Hot Cooked Steel Crucible
23 | Hot Failed Steel Crucible
24 | Hot Steel Ingot
25 | Hot Steel Chunk
--------------------------------
26 | Hot Steel Pickaxe Head
27 | Hot Steel Axe Head
28 | Hot Steel Shovel Head
29 | Hot Steel Hoe Head

1
kfc/banned-ips.json Normal file
View File

@@ -0,0 +1 @@
[]

1
kfc/banned-players.json Normal file
View File

@@ -0,0 +1 @@
[]

117
kfc/build.gradle Normal file
View File

@@ -0,0 +1,117 @@
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
}
}
repositories {
maven {
name = "jei"
url "http://dvs1.progwml6.com/files/maven"
}
maven {
name = "mobius"
url "http://mobiusstrip.eu/maven"
}
maven {
name = "primal"
url "https://maven.nmd.so"
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'java'
compileJava {
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
}
group = "${mod_group}"
version = "${mod_version}"
archivesBaseName = "${mod_name}"
idea { module { inheritOutputDirs = true } }
minecraft {
version = "${mc_version}" + "-" + "${forge_version}"
runDir = "run"
mappings = "${mcp_mappings}"
// JEI
//useDepAts = true
// Replace
replace "@VERSION@", project.mod_version
}
dependencies {
// you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"
// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
// except that these dependencies get remapped to your current MCP mappings
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/ddependency_management.html
// JEI
// https://github.com/mezz/JustEnoughItems
// http://minecraft.curseforge.com/projects/just-enough-items-jei/files
// <MINECRAFT-VERSION> and <JEI-VERSION> can be found on CurseForge, check the file name of the version you want.
//
// compile against the JEI API
deobfCompile "mezz.jei:jei_${mc_version}:${jei_version}:api"
//runtime "mezz.jei:jei_${mc_version}:${jei_version}"
deobfCompile "nmd.primal.core:PrimalCore:${primal_version}:dev"
//runtime "nmd.primal.core:PrimalCore:${primal_version}"
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", "${mod_version}"
inputs.property "mcversion", "${mc_version}"
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':"${mod_version}", 'mcversion':"${mc_version}"
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
// end //

3
kfc/eula.txt Normal file
View File

@@ -0,0 +1,3 @@
#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula).
#Sat Apr 01 13:44:13 EDT 2017
eula=true

16
kfc/gradle.properties Normal file
View File

@@ -0,0 +1,16 @@
# ~/.gradle/gradle.properties
#
#org.gradle.daemon=true
org.gradle.jvmargs=-Xmx3G
mod_group=nmd.primal.forgecraft
mod_name=ForgeCraft
mod_version=1.2.51
forge_version=13.20.0.2315
mcp_mappings=snapshot_20170121
mc_version=1.11.2
primal_version=0.4+
jei_version=4.3+
waila_version=1.7.0-B3
apple_version=2.1+

BIN
kfc/gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#Sun Jun 04 19:50:32 EDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-all.zip

164
kfc/gradlew vendored Normal file
View File

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

90
kfc/gradlew.bat vendored Normal file
View File

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

0
kfc/hs_err_pid57520.log Normal file
View File

1
kfc/ops.json Normal file
View File

@@ -0,0 +1 @@
[]

39
kfc/server.properties Normal file
View File

@@ -0,0 +1,39 @@
#Minecraft server properties
#Fri Jun 09 22:53:20 PDT 2017
max-tick-time=60000
generator-settings=
force-gamemode=false
allow-nether=true
gamemode=1
enable-query=false
player-idle-timeout=0
difficulty=1
spawn-monsters=false
op-permission-level=4
announce-player-achievements=true
pvp=true
snooper-enabled=true
level-type=DEFAULT
hardcore=false
enable-command-block=false
max-players=20
network-compression-threshold=256
resource-pack-sha1=
max-world-size=29999984
server-port=25565
server-ip=
spawn-npcs=true
allow-flight=true
level-name=world
view-distance=10
resource-pack=
spawn-animals=true
white-list=false
generate-structures=true
online-mode=false
max-build-height=256
level-seed=
use-native-transport=true
prevent-proxy-connections=false
motd=A Minecraft Server
enable-rcon=false

BIN
kfc/servers.dat Normal file

Binary file not shown.

View File

@@ -0,0 +1,36 @@
package nmd.primal.forgecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.items.tools.CustomPickaxe;
/**
* Created by mminaie on 3/15/17.
*/
public class ClientEvents {
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority= EventPriority.LOWEST, receiveCanceled=true)
public void toolTipOverride(ItemTooltipEvent event) {
Entity entity = event.getEntity();
if (entity instanceof EntityPlayer)
{
ItemStack held_stack = ((EntityPlayer) entity).getActiveItemStack();
if(held_stack.getItem() instanceof CustomPickaxe){
event.getToolTip().clear();
if(entity.getEntityWorld().isRemote) {
event.setCanceled(true);
}
}
}
}
}

View File

@@ -0,0 +1,125 @@
package nmd.primal.forgecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
import nmd.primal.forgecraft.items.parts.BronzeToolPart;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.items.tools.*;
import nmd.primal.forgecraft.util.ToolNBT;
/**
* Created by mminaie on 3/15/17.
*/
public class CommonEvents implements ToolNBT {
@SubscribeEvent(priority= EventPriority.LOWEST, receiveCanceled=true)
public void onItemCrafted(PlayerEvent.ItemCraftedEvent event) {
if(!event.player.getEntityWorld().isRemote) {
if (event.crafting.getItem() instanceof CustomPickaxe || event.crafting.getItem() instanceof BronzePickaxe) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
}
}
}
}
if (event.crafting.getItem() instanceof CustomAxe || event.crafting.getItem() instanceof BronzeAxe) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
}
}
}
}
if (event.crafting.getItem() instanceof CustomShovel || event.crafting.getItem() instanceof BronzeShovel) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
}
}
}
}
if (event.crafting.getItem() instanceof CustomHoe || event.crafting.getItem() instanceof BronzeHoe) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
}
}
}
}
if (event.crafting.getItem() instanceof ToolPart || event.crafting.getItem() instanceof BronzeToolPart) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof CustomAxe || a.getItem() instanceof BronzeAxe) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage);
}
if (a.getItem() instanceof CustomPickaxe || a.getItem() instanceof BronzePickaxe) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage);
}
if (a.getItem() instanceof CustomShovel || a.getItem() instanceof BronzeShovel) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage);
}
if (a.getItem() instanceof CustomHoe || a.getItem() instanceof BronzeHoe) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage);
}
}
}
}
}
}
}

View File

@@ -0,0 +1,70 @@
package nmd.primal.forgecraft;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.fml.common.registry.GameRegistry;
/**
* Created by kitsu on 11/23/2016.
*/
public class CommonUtils {
public static void print(Object object){
System.out.println(object);
}
public static int getVanillaItemBurnTime(ItemStack stack)
{
if (stack == null)
{
return 0;
}
Item item = stack.getItem();
if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.AIR)
{
Block block = Block.getBlockFromItem(item);
if (block == Blocks.WOODEN_SLAB) return 150;
if (block.getDefaultState().getMaterial() == Material.WOOD) return 300;
if (block == Blocks.COAL_BLOCK) return 16000;
}
//if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200;
//if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200;
//if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200;
if(item == Items.STICK) return 100;
if(item == Items.COAL) return 1600;
if (item == Item.getItemFromBlock(Blocks.SAPLING)) return 100;
if (item == Items.BLAZE_ROD) return 2400;
if (item == Items.BLAZE_POWDER) return 800;
return GameRegistry.getFuelValue(stack);
}
public static void spawnItemEntity(World world, EntityPlayer player, ItemStack stack)
{
EntityItem entityitem = new EntityItem(world, player.posX, player.posY, player.posZ, stack); // player.posY - 1.0D
world.spawnEntity(entityitem);
if (!(player instanceof FakePlayer))
entityitem.onCollideWithPlayer(player);
}
public static void spawnItemEntityFromWorld(World world, BlockPos pos, ItemStack stack){
EntityItem entityitem = new EntityItem(world, pos.getX(), pos.getY() + 1, pos.getZ(), stack); // player.posY - 1.0D
world.spawnEntity(entityitem);
}
}

View File

@@ -0,0 +1,81 @@
package nmd.primal.forgecraft;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import nmd.primal.forgecraft.compat.ModDictionary;
import nmd.primal.forgecraft.gui.GuiHandler;
import nmd.primal.forgecraft.init.*;
import nmd.primal.forgecraft.proxy.CommonProxy;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.Locale;
//import nmd.primal.forgecraft.common.init.*;
@Mod( modid = ModInfo.MOD_ID,
name = ModInfo.MOD_ID,
version = ModInfo.MOD_VERSION,
acceptedMinecraftVersions = ModInfo.MC_VERSIONS,
dependencies = ModInfo.DEPENDENCIES
//guiFactory = ModInfo.GUI_FACTORY,
//updateJSON = ModInfo.UPDATE_JSON
)
public class ForgeCraft
{
@Instance
public static ForgeCraft instance;
public static SimpleNetworkWrapper NETWORK;
@SidedProxy(clientSide = ModInfo.CLIENT_PROXY, serverSide = ModInfo.SERVER_PROXY)
public static CommonProxy proxy;
public static Logger LOGGER = LogManager.getLogger(ModInfo.MOD_ID);
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
Locale.setDefault(Locale.ENGLISH);
NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel(ModInfo.MOD_CHANNEL);
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
ModBlocks.init();
ModBlocks.register();
ModItems.init();
ModItems.register();
ModTiles.registerTileEntities();
ModSounds.registerSounds();
ModEvents.registerCommonEvents();
//ModEvents.registerClientEvents();
// ModItems.registerRenders();
proxy.preInit();
}
@EventHandler
public void init(FMLInitializationEvent event)
{
//this.proxy.init(event);
proxy.init();
ModDictionary.registerDictionaryNames();
ModCrafting.register();
//proxy.registerModelBakeryVariants();
}
@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
//this.proxy.postInit(event);
}
}

View File

@@ -0,0 +1,39 @@
package nmd.primal.forgecraft;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.init.ModItems;
//import nmd.primal.forgecraft.Item.ModItems;
/**
* Created by kitsu on 11/24/2016.
*/
public class ModInfo {
/** Mod Details**/
public static final String MOD_ID = "forgecraft";
public static final String MOD_NAME = "Kitsu's ForgeCraft";
public static final String MOD_CONFIG = "primal/" + MOD_ID;
//public static final String MOD_PREFIX = MOD_ID + ":";
public static final String MOD_CHANNEL = MOD_ID;
public static final String MOD_VERSION = "1.2.51";
public static final String MC_VERSIONS = "[1.11.0, 1.12.0)";
public static final String DEPENDENCIES = "required-after:forge@[13.20.0.2315,);" + "required-after:primal@[0.4,);";
/** Mod Structures **/
public static final String SERVER_PROXY = "nmd.primal.forgecraft.proxy.ServerProxy";
public static final String CLIENT_PROXY = "nmd.primal.forgecraft.proxy.ClientProxy";
//public static final String GUI_FACTORY = "nmd.primal.forgecraft.gui.GuiFactory";
//public static final String UPDATE_JSON = "";
/** Creative Tabs **/
public static CreativeTabs TAB_FORGECRAFT = new CreativeTabs(MOD_ID)
{
@Override
@SideOnly(Side.CLIENT)
public ItemStack getTabIconItem() {
return new ItemStack(ModItems.forgehammer);
}
};
}

View File

@@ -0,0 +1,148 @@
package nmd.primal.forgecraft.blocks.Anvil;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.tiles.TileAnvil;
import nmd.primal.forgecraft.util.AnvilHandler;
/**
* Created by mminaie on 6/11/17.
*/
public abstract class AnvilBase extends CustomContainerFacing implements AnvilHandler{
private boolean anvil;
public AnvilBase(Material material, String registryName, Float hardness, Boolean anvil) {
super(material, registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setHardness(hardness);
this.setIsAnvil(anvil);
}
public boolean isAnvil() {
return anvil;
}
public void setIsAnvil(boolean anvil) {
anvil = anvil;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
AnvilHandler.doDrops(world, pos);
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileAnvil();
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if( state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if( state.getValue(FACING) == EnumFacing.SOUTH){
i = 2;
return i;
}
if( state.getValue(FACING) == EnumFacing.NORTH){
i = 3;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullyOpaque(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -0,0 +1,63 @@
package nmd.primal.forgecraft.blocks.Anvil;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import nmd.primal.core.common.items.tools.WorkMallet;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.tiles.TileAnvil;
import nmd.primal.forgecraft.util.AnvilHandler;
/**
* Created by mminaie on 6/10/17.
*/
public class AnvilIron extends AnvilBase implements AnvilHandler {
public AnvilIron(Material material, String registryName, Float hardness, Boolean anvil) {
super(material, registryName, hardness, anvil);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
/******************************************************************************
Crafting AnvilStone Recipes
*****************************************************************************/
if (!world.isRemote) {
ItemStack pItem = player.inventory.getCurrentItem();
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
if (tile != null) {
if ((pItem.getItem() instanceof WorkMallet) || (pItem.getItem() == ModItems.forgehammer)) {
String[] tempArray = new String[25];
for (int i = 0; i < 25; i++) {
tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
}
/*for (int i = 0; i < 25; i++) {
if (tile.getSlotStack(i).getItem() instanceof BaseMultiItem) {
if (((BaseMultiItem) tile.getSlotStack(i).getItem()).getMaterial(tile.getSlotStack(i).getItem()) != PrimalMaterials.TOOL_BASIC_STEEL
|| ((BaseMultiItem) tile.getSlotStack(i).getItem()).getMaterial(tile.getSlotStack(i).getItem()) != PrimalMaterials.TOOL_CLEAN_IRON
|| ((BaseMultiItem) tile.getSlotStack(i).getItem()).getMaterial(tile.getSlotStack(i).getItem()) != PrimalMaterials.TOOL_WROUGHT_IRON
) {
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(PrimalItems.ROCK_STONE, 3));
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.ironball, 1));
this.breakBlock(world, pos, state);
}
}
}*/
doAnvilRecipe(pItem, tempArray, world, tile, pos, player);
return true;
}
doAnvilInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
return true;
}
}
return false;
}
}

View File

@@ -0,0 +1,7 @@
package nmd.primal.forgecraft.blocks.Anvil;
/**
* Created by mminaie on 6/10/17.
*/
public class AnvilSteel {
}

View File

@@ -0,0 +1,65 @@
package nmd.primal.forgecraft.blocks.Anvil;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import nmd.primal.core.api.PrimalItems;
import nmd.primal.core.api.PrimalMaterials;
import nmd.primal.core.common.items.tools.WorkMallet;
import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.BaseMultiItem;
import nmd.primal.forgecraft.tiles.TileAnvil;
/**
* Created by mminaie on 3/4/17.
*/
public class AnvilStone extends AnvilBase {
public AnvilStone(Material material, String registryName, Float hardness, Boolean anvil) {
super(material, registryName, hardness, anvil);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
/******************************************************************************
Crafting AnvilStone Recipes
*****************************************************************************/
if (!world.isRemote) {
ItemStack pItem = player.inventory.getCurrentItem();
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
if (tile != null) {
if ((pItem.getItem() instanceof WorkMallet) || (pItem.getItem() == ModItems.forgehammer)) {
String[] tempArray = new String[25];
for (int i = 0; i < 25; i++) {
tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
}
for (int i = 0; i < 25; i++) {
if (tile.getSlotStack(i).getItem() instanceof BaseMultiItem) {
if (((BaseMultiItem) tile.getSlotStack(i).getItem()).getMaterial(tile.getSlotStack(i).getItem()) != PrimalMaterials.TOOL_WROUGHT_IRON) {
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(PrimalItems.ROCK_STONE, 3));
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.ironball, 1));
this.breakBlock(world, pos, state);
return true;
}
}
}
doAnvilRecipe(pItem, tempArray, world, tile, pos, player);
return true;
}
doAnvilInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
return true;
}
}
return false;
}
}

View File

@@ -0,0 +1,20 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import nmd.primal.forgecraft.ModInfo;
/**
* Created by mminaie on 2/6/17.
*/
public class BlockBase extends Block{
public BlockBase(Material material, String registryName, Float hardness) {
super(material);
setUnlocalizedName(registryName);
setRegistryName(registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setHardness(hardness);
}
}

View File

@@ -0,0 +1,60 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* Created by mminaie on 2/6/17.
*/
public class BlockCustomBase extends BlockBase {
public AxisAlignedBB boundBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
public BlockCustomBase(Material material, String registryName, Float hardness) {
super(material, registryName, hardness);
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return boundBox;
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullyOpaque(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -0,0 +1,417 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.core.common.crafting.FireSource;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.BloomeryCrafting;
import nmd.primal.forgecraft.tiles.TileBloomery;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 6/11/17.
*/
public class BloomeryBase extends CustomContainerFacing implements ITileEntityProvider {
//public static final PropertyBool COVERED = PropertyBool.create("covered");
private int maxHeat;
public BloomeryBase(Material material, String registryName, Integer maxHeat) {
super(material, registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)));
setHardness(3.0f);
setResistance(5.0f);
this.maxHeat=maxHeat;
}
public int getMaxHeat() {
return maxHeat;
}
public void setMaxHeat(int maxHeat) {
this.maxHeat = maxHeat;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileBloomery();
}
/*@Override
public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
{
this.updateTick(world, pos, state, random);
if(!world.isRemote){
if(state.getValue(PrimalStates.ACTIVE) == true) {
FireHelper.makeSmoke(world, pos, 50);
}
}
}*/
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if (!world.isRemote) {
TileBloomery tile = (TileBloomery) world.getTileEntity(pos);
if (tile != null) {
ItemStack pItem = player.inventory.getCurrentItem();
ItemStack tileItem = tile.getSlotStack(0);
ItemStack tileItem1 = tile.getSlotStack(1);
if(pItem.isEmpty()) {
if(!player.isSneaking()){
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE) == true){
Integer bloomeryHeat = tile.getHeat();
Integer idealTemp = null;
Integer cookCounter = tile.getCookCounter();
Integer idealCookTime = null;
Integer remainingTime = null;
String stringBloomeryHeat = bloomeryHeat.toString();
String stringIdealTemp = "";
String stringRemainingTime = "";
BloomeryCrafting recipe = BloomeryCrafting.getRecipe(tile.getSlotStack(1));
if(recipe != null) {
idealTemp = recipe.getHeatThreshold();
idealCookTime = recipe.getIdealTime();
stringIdealTemp = idealTemp.toString();
remainingTime = idealCookTime - cookCounter;
stringRemainingTime = remainingTime.toString();
}
String display =
"Current Temp: " + stringBloomeryHeat
+ "Ideal Temp: " + stringIdealTemp
+ "Ticks Remaining: " + stringRemainingTime
+ "Fuel Remaining: " + tile.getSlotStack(0).getCount();
ITextComponent itextcomponent = new TextComponentString(display);
player.sendStatusMessage(itextcomponent, true);
return true;
}
}
}
if(tile.getSlotStack(0) != ItemStack.EMPTY) {
if((FireSource.useSource(world, pos, player, pItem, hand, facing, hitX, hitY, hitZ))) {
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, true), 2);
tile.setHeat(100);
tile.markDirty();
tile.updateBlock();
return true;
}
}
if((!pItem.isEmpty()) && tile.isItemValidForSlot(0, pItem)) {
if (!tileItem.isEmpty()){
if(pItem.getItem() == tileItem.getItem()){
if(tileItem.getCount() < 64){
if(tileItem.getCount() + pItem.getCount() <= 64){
tileItem.grow(pItem.getCount());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
tile.markDirty();
tile.updateBlock();
return true;
}
if(tileItem.getCount() + pItem.getCount() > 64){
pItem.setCount(64-pItem.getCount());
tileItem.setCount(64);
tile.markDirty();
tile.updateBlock();
return true;
}
}
}
}
if(tileItem.isEmpty()) {
tile.setSlotStack(0, pItem);
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
if((!pItem.isEmpty()) && tile.isItemValidForSlot(1, pItem)) {
if (!tileItem1.isEmpty()) {
return false;
}
if(tileItem1.isEmpty()){
ItemStack tempItem = new ItemStack(pItem.getItem(), 1);
tile.setSlotStack(1, tempItem);
pItem.shrink(1);
return true;
}
}
if (player.isSneaking()) {
if (!tile.getSlotStack(0).isEmpty()) {
if(player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
ItemStack returnStack = tile.getSlotStack(0).copy();
PlayerHelper.spawnItemOnPlayer(world, player, returnStack);
tile.clearSlot(0);
return true;
}
}
}
}
}
return false;
}
@Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{
int lightState =0;
if(state.getValue(PrimalStates.ACTIVE) == true){
lightState = 10;
}
return lightState;
}
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return 0;
}
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return true;
}
@Override
public boolean isFireSource(World world, BlockPos pos, EnumFacing side)
{
if(!world.isRemote){
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE)==true){
return true;
}
}
return false;
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent)
{
if(ent instanceof EntityPlayer){
if(state.getValue(PrimalStates.ACTIVE) == true){
ent.setFire(1);
}
}
}
/**
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
*/
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileBloomery tile = (TileBloomery) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalStates.ACTIVE) == false){
i = 0;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalStates.ACTIVE) == false){
i = 1;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalStates.ACTIVE) == false){
i = 2;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalStates.ACTIVE) == false){
i = 3;
return i;
}
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalStates.ACTIVE) == true){
i = 4;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalStates.ACTIVE) == true){
i = 5;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalStates.ACTIVE) == true){
i = 6;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalStates.ACTIVE) == true){
i = 7;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing enumfacing;
Boolean active;
switch (meta & 7)
{
case 0:
enumfacing = EnumFacing.EAST;
active = false;
break;
case 1:
enumfacing = EnumFacing.WEST;
active = false;
break;
case 2:
enumfacing = EnumFacing.SOUTH;
active = false;
break;
case 3:
enumfacing = EnumFacing.NORTH;
active = false;
break;
case 4:
enumfacing = EnumFacing.EAST;
active = true;
break;
case 5:
enumfacing = EnumFacing.WEST;
active = true;
break;
case 6:
enumfacing = EnumFacing.SOUTH;
active = true;
break;
case 7:
enumfacing = EnumFacing.NORTH;
active = true;
break;
default:
enumfacing = EnumFacing.NORTH;
active = false;
}
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(active));
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalStates.ACTIVE});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullyOpaque(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
@SideOnly(Side.CLIENT)
@SuppressWarnings("incomplete-switch")
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
{
if(state.getValue(PrimalStates.ACTIVE) == true)
{
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.2D;
double d2 = (double)pos.getZ() + 0.5D;
double d3 = 0.52D;
double d4 = ThreadLocalRandom.current().nextDouble(0.075, 0.35);
double ySpeed = ThreadLocalRandom.current().nextDouble(0.0, 0.075);
if (rand.nextDouble() < 0.1D)
{
world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
}
if(rand.nextInt(4) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 4){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
}
}
}

View File

@@ -0,0 +1,242 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.core.common.items.tools.WorkMallet;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.tiles.TileBreaker;
import nmd.primal.forgecraft.util.BreakerHandler;
/**
* Created by mminaie on 4/9/17.
*/
public class Breaker extends CustomContainerFacing implements BreakerHandler {
public Breaker(Material material, String registryName, Float hardness) {
super(material, registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, false));
setHardness(hardness);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if(!world.isRemote){
TileBreaker tile = (TileBreaker) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
/*if(tile.getCharge() < 5 ){
if(pItem == ItemStack.EMPTY){
if(player.isSneaking()){
ItemStack tempStack = tile.getSlotStack(0).copy();
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
tile.setSlotStack(0, ItemStack.EMPTY);
return true;
}
}
}*/
if(state.getValue(PrimalStates.ACTIVE) == true && player.isSneaking() && pItem.isEmpty()){
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalStates.ACTIVE, false));
doBreaking(world, state, pos, tile);
tile.setCharge(0);
return true;
}
if(!player.isSneaking() && pItem.isEmpty()) {
if (!state.getValue(PrimalStates.ACTIVE)) {
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalStates.ACTIVE, true), 2);
return true;
}
if(state.getValue(PrimalStates.ACTIVE)) {
if (tile.getCharge() < 181) {
tile.setCharge(tile.getCharge() + 2.0f);
tile.updateBlock();
//System.out.println(tile.charge);
return true;
}
}
}
if(pItem.getItem() instanceof WorkMallet){
tile.setSlotStack(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
return false;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileBreaker tile = (TileBreaker) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileBreaker();
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, false), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if(state.getValue(PrimalStates.ACTIVE ) == false) {
if (state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
i = 2;
return i;
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
i = 3;
return i;
}
}
if(state.getValue(PrimalStates.ACTIVE)) {
if (state.getValue(FACING) == EnumFacing.EAST) {
i = 4;
return i;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
i = 5;
return i;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
i = 6;
return i;
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
i = 7;
return i;
}
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalStates.ACTIVE, false);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalStates.ACTIVE, false);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalStates.ACTIVE, false);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, false);
}
if (meta == 4){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalStates.ACTIVE, true);
}
if (meta == 5) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalStates.ACTIVE, true);
}
if (meta == 6) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalStates.ACTIVE, true);
}
if (meta == 7) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, true);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {PrimalStates.ACTIVE, FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullyOpaque(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -0,0 +1,667 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.casting.CastingPart;
import nmd.primal.forgecraft.tiles.TileCastingBlock;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 6/24/17.
*/
public class CastingBlock extends CustomContainerFacing {
protected static AxisAlignedBB bound = new AxisAlignedBB(0/16D, 0.0D, 0/16D, 16/16D, 5.5/16D, 16/16D);
public CastingBlock(Material material, String registryName) {
super(material, registryName);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
private void makeEmbers(World world, BlockPos pos, Random rand){
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.2D;
double d2 = (double)pos.getZ() + 0.5D;
double d3 = 0.52D;
double d4 = ThreadLocalRandom.current().nextDouble(0.066, 0.33);
double ySpeed = ThreadLocalRandom.current().nextDouble(0.05, 0.20);
if(rand.nextInt(3) == 0){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, ySpeed, ySpeed, ySpeed, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, ySpeed, ySpeed, ySpeed, new int[0]);
}
if(rand.nextInt(3) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, ySpeed, ySpeed, ySpeed, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, ySpeed, ySpeed, ySpeed, new int[0]);
}
if(rand.nextInt(3) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, ySpeed, ySpeed, ySpeed, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, ySpeed, ySpeed, ySpeed, new int[0]);
}
if(rand.nextInt(3) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, ySpeed, ySpeed, ySpeed, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, ySpeed, ySpeed, ySpeed, new int[0]);
}
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if (!world.isRemote) {
TileCastingBlock tile = (TileCastingBlock) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
if(player.isSneaking()) {
if(!tile.getSlotStack(0).isEmpty()){
ItemStack copyStack = tile.getSlotStack(0).copy();
PlayerHelper.spawnItemOnPlayer(world, player, copyStack);
tile.setSlotStack(0, ItemStack.EMPTY);
tile.updateBlock();
return true;
}
}
if(pItem.getItem() instanceof CastingPart){
if(!player.isSneaking()) {
if (tile.getSlotStack(0).isEmpty()) {
ItemStack copyStack = pItem.copy();
copyStack.setCount(1);
pItem.shrink(1);
tile.setSlotStack(0, copyStack);
tile.updateBlock();
return true;
}
}
}
if(pItem.getItem() == ModItems.stonetongs ){
if(pItem.getTagCompound().getInteger("type") == 40){
if(tile.getSlotStack(0).getItem() == ModItems.cast_hoe){
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
//makeEmbers(world, pos, world.rand);
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe){
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_axe){
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_shovel){
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_gladius){
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
}
/***************************
* Bronze *
*
46 | Hot Cooked Bronze Crucible Emerald
48 | Hot Cooked Bronze Crucible Diamond
50 | Hot Cooked Bronze Crucible Redstone
52 | Hot Cooked Bronze Crucible Lapis
***************************/
if(pItem.getTagCompound().getInteger("type") == 46){
if(tile.getSlotStack(0).getItem() == ModItems.cast_hoe){
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", true);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe){
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", true);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_axe){
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", true);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_shovel){
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", true);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_gladius){
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
}
if(pItem.getTagCompound().getInteger("type") == 48) {
if (tile.getSlotStack(0).getItem() == ModItems.cast_hoe) {
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 1);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if (CommonUtils.randomCheck(2)) {
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe) {
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 1);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if (CommonUtils.randomCheck(2)) {
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_axe) {
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 1);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if (CommonUtils.randomCheck(2)) {
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_shovel) {
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 1);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if (CommonUtils.randomCheck(2)) {
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_gladius) {
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if (CommonUtils.randomCheck(2)) {
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
}
if(pItem.getTagCompound().getInteger("type") == 50) {
if (tile.getSlotStack(0).getItem() == ModItems.cast_hoe) {
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 1);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe) {
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 1);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_axe) {
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 1);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_shovel) {
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 1);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_gladius) {
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
}
if(pItem.getTagCompound().getInteger("type") == 52) {
if (tile.getSlotStack(0).getItem() == ModItems.cast_hoe) {
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 1);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe) {
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 1);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_axe) {
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 1);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_shovel) {
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 1);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_gladius) {
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
}
}
}
return false;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileCastingBlock tile = (TileCastingBlock) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileCastingBlock();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return bound;
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if( state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if( state.getValue(FACING) == EnumFacing.SOUTH){
i = 2;
return i;
}
if( state.getValue(FACING) == EnumFacing.NORTH){
i = 3;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullyOpaque(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -0,0 +1,170 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.tiles.TileCastingForm;
import nmd.primal.forgecraft.util.CastingFormHandler;
import java.util.Random;
/**
* Created by mminaie on 6/19/17.
*/
public class CastingForm extends CustomContainerFacing implements CastingFormHandler{
protected static AxisAlignedBB bound = new AxisAlignedBB(0/16D, 0.0D, 0/16D, 16/16D, 5/16D, 16/16D);
public CastingForm(Material material, String registryName) {
super(material, registryName);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setTickRandomly(true);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if (!world.isRemote) {
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
doInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
return false;
}
return false;
}
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random random)
{
if (!world.isRemote) {
if(CommonUtils.randomCheck(10)) {
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
String[] tempArray = new String[25];
for (int i = 0; i < 25; i++) {
tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
}
doCraftingformCrafting(tempArray, world, tile, pos);
}
}
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileCastingForm();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return bound;
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if( state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if( state.getValue(FACING) == EnumFacing.SOUTH){
i = 2;
return i;
}
if( state.getValue(FACING) == EnumFacing.NORTH){
i = 3;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullyOpaque(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -0,0 +1,196 @@
package nmd.primal.forgecraft.blocks.Crucibles;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalItems;
import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModBlocks;
import org.apache.commons.lang3.StringUtils;
import java.util.Random;
import static nmd.primal.forgecraft.CommonUtils.spawnItemEntityFromWorld;
/**
* Created by mminaie on 1/24/17.
*/
public class Crucible extends Block {
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(4/16D, 0.0D, 4/16D, 12/16D, 7/16D, 12/16D);
//public static final PropertyInteger SIZE = PropertyInteger.create("size", 0, 3);
public Crucible(Material material, String registryName) {
super(material);
setUnlocalizedName(registryName);
setRegistryName(registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setHardness(3.0f);
//this.blockState.getBaseState().withProperty(SIZE, Integer.valueOf(0));
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
ItemStack pItem = player.inventory.getCurrentItem();
if(pItem.isEmpty()){
CommonUtils.spawnItemEntity(world, player, new ItemStack(this, 1));
world.setBlockToAir(pos);
return true;
}
if(Block.getBlockFromItem(pItem.getItem()) == this){
CommonUtils.spawnItemEntity(world, player, new ItemStack(this, 1));
world.setBlockToAir(pos);
return true;
}
}
return false;
}
/*@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
ret.add(0, new ItemStack(ModBlocks.emptycrucible, 1));
if(this.getUnlocalizedName()=="tile.coolironcrucible"){
ret.add(1, new ItemStack(Items.IRON_INGOT, 1));
}
return ret;
}*/
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
{
if(!world.isRemote){
if(this.getUnlocalizedName().equals("tile.emptycruciblecracked")){} else spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.emptycrucible, 1));
if(StringUtils.isEmpty(this.getUnlocalizedName()) == false) {
if(checkDrops(this.getUnlocalizedName()) != null) {
if (checkDrops(this.getUnlocalizedName()).equals(this.getUnlocalizedName())) {
spawnItemEntityFromWorld(world, pos, new ItemStack(getItemFromName(this.getUnlocalizedName()), 1));
}
}
}
}
}
private String checkDrops(String name){
String string = null;
if(name.equals("tile.coolironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.coolcleanironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawcleanironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.coolsteelcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawsteelcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.coolwootzcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawwootzcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.emptycruciblecracked")){
string = this.getUnlocalizedName();
}
return string;
}
private Item getItemFromName(String name){
if(name.equals("tile.coolironcrucible")){
return Item.getItemFromBlock(ModBlocks.ironball);
} else if (name.equals("tile.rawironcrucible")){
return Item.getItemFromBlock(Blocks.IRON_ORE);
} else if (name.equals("tile.coolcleanironcrucible")){
return Item.getItemFromBlock(ModBlocks.ironcleanball);
} else if (name.equals("tile.rawcleanironcrucible")){
return PrimalItems.IRON_DUST;
} else if (name.equals("tile.coolsteelcrucible")){
return Item.getItemFromBlock(ModBlocks.steelball);
} else if (name.equals("tile.rawsteelcrucible")){
return Item.getItemFromBlock(ModBlocks.ironcleanball);
} else if (name.equals("tile.coolwootzcrucible")){
return Item.getItemFromBlock(ModBlocks.wootzball);
} else if (name.equals("tile.rawcleanironcrucible")){
return PrimalItems.GOLDEN_STICK;
}else if (name.equals("tile.emptycruciblecracked")){
return Items.CLAY_BALL;
}
else return Items.AIR;
}
@Override
public int quantityDropped(Random random)
{
return 0;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return boundBox;
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullyOpaque(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -0,0 +1,107 @@
package nmd.primal.forgecraft.blocks.Crucibles;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDynamicLiquid;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.tiles.TileBaseCrucible;
import java.util.Random;
/**
* Created by mminaie on 2/4/17.
*/
public class CrucibleHot extends Block implements ITileEntityProvider {
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(4/16D, 0.0D, 4/16D, 12/16D, 7/16D, 12/16D);
//public static final PropertyInteger SIZE = PropertyInteger.create("size", 0, 3);
public CrucibleHot(Material material, String registryName) {
super(material);
setUnlocalizedName(registryName);
setRegistryName(registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setHardness(3.0f);
//this.blockState.getBaseState().withProperty(SIZE, Integer.valueOf(0));
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
return false;
}
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
{
if(!world.isRemote){
world.setBlockState(pos, Blocks.FLOWING_LAVA.getDefaultState().withProperty(BlockDynamicLiquid.LEVEL, 1), 3);
}
}
@Override
public int quantityDropped(Random random)
{
return 0;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileBaseCrucible();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return boundBox;
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullyOpaque(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -0,0 +1,22 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
/**
* Created by mminaie on 3/4/17.
*/
public abstract class CustomContainer extends BlockContainer{
protected CustomContainer(Material material)
{
super(material);
}
protected CustomContainer(Material material, MapColor color)
{
super(material, color);
}
}

View File

@@ -0,0 +1,29 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.util.EnumFacing;
/**
* Created by kitsu on 12/3/2016.
*/
public abstract class CustomContainerFacing extends BlockContainer {
public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
protected CustomContainerFacing(Material material, String registryName)
{
super(material);
this.setRegistryName(registryName);
this.setUnlocalizedName(registryName);
this.setHardness(3.0f);
this.setResistance(4.0f);
}
protected CustomContainerFacing(Material material, MapColor color)
{
super(material, color);
}
}

View File

@@ -0,0 +1,26 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.util.EnumFacing;
/**
* Created by mminaie on 1/1/17.
*/
public abstract class CustomFacing extends Block {
public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
protected CustomFacing(Material material)
{
super(material);
}
protected CustomFacing(Material material, MapColor color)
{
super(material, color);
}
}

View File

@@ -0,0 +1,494 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.core.common.crafting.FireSource;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.tiles.TileForge;
import javax.annotation.Nullable;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
//import nmd.primal.core.api.PrimalBlocks;
/**
* Created by kitsu on 11/26/2016.
*/
public class Forge extends CustomContainerFacing implements ITileEntityProvider{
private int maxHeat;
//public static final PropertyBool PrimalStates.ACTIVE = PropertyBool.create("PrimalStates.ACTIVE");
protected static final AxisAlignedBB collideBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.99D, 1.0D);
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
public Forge(Material material, String name, Integer maxHeat) {
super(material, name);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)));
setHardness(3.0f);
setResistance(5.0f);
this.maxHeat=maxHeat;
}
public int getMaxHeat() {
return maxHeat;
}
public void setMaxHeat(int maxHeat) {
this.maxHeat = maxHeat;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileForge();
}
@Nullable
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
{
return collideBox;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return boundBox;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if (!world.isRemote) {
TileForge tile = (TileForge) world.getTileEntity(pos);
if (tile != null) {
ItemStack pItem = player.inventory.getCurrentItem();
ItemStack fuelItem = tile.getSlotStack(0);
//System.out.println(pItem.getItem().getRegistryName().toString());
/***********************
FUEL SLOT CODE
***********************/
if (player.isSneaking()) {
if (!tile.getSlotStack(0).isEmpty()) {
if(player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
ItemStack returnStack = tile.getSlotStack(0).copy();
PlayerHelper.spawnItemOnPlayer(world, player, returnStack);
tile.clearSlot(0);
return true;
}
}
}
if(pItem.isEmpty()) {
if(!player.isSneaking()){
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE) == true){
Integer tempInt = tile.getHeat();
String tempString = tempInt.toString();
ITextComponent itextcomponent = new TextComponentString(tempString);
player.sendStatusMessage(itextcomponent, true);
//System.out.println(pos);
return true;
}
}
}
if((FireSource.useSource(world, pos, player, pItem, hand, facing, hitX, hitY, hitZ))) {
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, true), 2);
tile.setHeat(100);
tile.markDirty();
tile.updateBlock();
return true;
}
if((!pItem.isEmpty()) && tile.isItemValidForSlot(0, pItem)) {
if (!fuelItem.isEmpty()){
if(pItem.getItem() == fuelItem.getItem()){
if(fuelItem.getCount() < 64){
if(fuelItem.getCount() + pItem.getCount() <= 64){
fuelItem.grow(pItem.getCount());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
tile.markDirty();
tile.updateBlock();
return true;
}
if(fuelItem.getCount() + pItem.getCount() > 64){
pItem.setCount(64-pItem.getCount());
fuelItem.setCount(64);
tile.markDirty();
tile.updateBlock();
return true;
}
}
}
}
if(fuelItem.isEmpty()) {
tile.setSlotStack(0, pItem);
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
/***********************
FORGING SLOTS CODE
***********************/
//REMOVE COOL INGOT
if(facing == EnumFacing.UP ) {
/*if (pItem.isEmpty()) {
for (int i = 2; i < tile.getSlotListSize(); i++) {
//System.out.println(i);
if (!tile.getSlotStack(i).isEmpty()) {
if (Block.getBlockFromItem(tile.getSlotStack(i).getItem()) instanceof IngotBall) {
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(i));
tile.setSlotStack(i, ItemStack.EMPTY);
return true;
}
if(tile.getSlotStack(i).hasTagCompound() == true){
if (tile.getSlotStack(i).getTagCompound().getBoolean("hot") == false) {
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(i));
tile.setSlotStack(i, ItemStack.EMPTY);
return true;
}
}
}
}
}*/
if (Block.getBlockFromItem(pItem.getItem()) instanceof IngotBall) {
//System.out.println("Activating");
for (int i = 2; i <= tile.getSlotListSize(); i++) {
if (tile.getSlotStack(i).isEmpty()) {
tile.setSlotStack(i, new ItemStack(pItem.getItem(), 1));
pItem.shrink(1);
return true;
}
}
}
//Needs Ore Dictionary Compat
if (pItem.getItem().equals(new ItemStack(Items.IRON_INGOT).getItem())) {
for (int i = 2; i < 7; i++) {
if (tile.getSlotStack(i).isEmpty()) {
tile.setSlotStack(i, new ItemStack(Items.IRON_INGOT, 1));
pItem.shrink(1);
return true;
}
}
}
if(pItem.getItem() instanceof ToolPart){
if(tile.getSlotStack(4).isEmpty()){
//System.out.println("Adding player Item to slot");
tile.setSlotStack(4, pItem);
//System.out.println(tile.getSlotStack(4));
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
}
}
//System.out.println(tile.getSlotStack(0));
//System.out.println(tile.getSlotStack(1));
//System.out.println(tile.getSlotStack(2));
//System.out.println(tile.getSlotStack(3));
//System.out.println(tile.getSlotStack(4));
//System.out.println(tile.getSlotStack(5));
//System.out.println(tile.getSlotStack(6));
}
return false;
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent)
{
//if (!world.isRemote){
if(ent instanceof EntityPlayer){
if(state.getValue(PrimalStates.ACTIVE) == true){
ent.setFire(1);
}
}
//}
}
public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) {
}
@Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{
if(state.getValue(PrimalStates.ACTIVE) == true){
return 15;
}
return 0;
}
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return 0;
}
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return true;
}
@Override
public boolean isFireSource(World world, BlockPos pos, EnumFacing side)
{
if (side == EnumFacing.UP)
{
if(!world.isRemote){
TileForge tile = (TileForge) world.getTileEntity(pos);
if(tile.getSlotStack(0) != ItemStack.EMPTY){
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE)==true){
return true;
}
}
}
}
return false;
}
/**
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
*/
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileForge tile = (TileForge) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
/*@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
IBlockState state = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
return state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false));
}*/
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalStates.ACTIVE) == false){
i = 0;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalStates.ACTIVE) == false){
i = 1;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalStates.ACTIVE) == false){
i = 2;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalStates.ACTIVE) == false){
i = 3;
return i;
}
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalStates.ACTIVE) == true){
i = 4;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalStates.ACTIVE) == true){
i = 5;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalStates.ACTIVE) == true){
i = 6;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalStates.ACTIVE) == true){
i = 7;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing enumfacing;
Boolean active;
switch (meta & 7)
{
case 0:
enumfacing = EnumFacing.EAST;
active = false;
break;
case 1:
enumfacing = EnumFacing.WEST;
active = false;
break;
case 2:
enumfacing = EnumFacing.SOUTH;
active = false;
break;
case 3:
enumfacing = EnumFacing.NORTH;
active = false;
break;
case 4:
enumfacing = EnumFacing.EAST;
active = true;
break;
case 5:
enumfacing = EnumFacing.WEST;
active = true;
break;
case 6:
enumfacing = EnumFacing.SOUTH;
active = true;
break;
case 7:
enumfacing = EnumFacing.NORTH;
active = true;
break;
default:
enumfacing = EnumFacing.NORTH;
active = false;
}
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(active));
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalStates.ACTIVE});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullyOpaque(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
@Override
public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
{
this.updateTick(world, pos, state, random);
if(!world.isRemote){
if(state.getValue(PrimalStates.ACTIVE) == true) {
makeSmoke(world, pos);
}
}
}
@SideOnly(Side.CLIENT)
@SuppressWarnings("incomplete-switch")
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
{
if(state.getValue(PrimalStates.ACTIVE) == true)
{
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.96D;
double d2 = (double)pos.getZ() + 0.5D;
double d3 = 0.52D;
double d4 = ThreadLocalRandom.current().nextDouble(0.075, 0.35);
double ySpeed = ThreadLocalRandom.current().nextDouble(0.0, 0.075);
if (rand.nextDouble() < 0.1D)
{
world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
}
if(rand.nextInt(4) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 4){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
}
}
}

View File

@@ -0,0 +1,119 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.BlockDynamicLiquid;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import nmd.primal.core.api.PrimalStates;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 2/6/17.
*/
public class IngotBall extends BlockCustomBase {
protected static AxisAlignedBB boundBoxLarge = new AxisAlignedBB(6/16D, 0.0D, 6/16D, 10/16D, 4/16D, 10/16D);
protected static AxisAlignedBB boundBoxSmall = new AxisAlignedBB(7/16D, 0.0D, 7/16D, 9/16D, 2/16D, 9/16D);
//public static final PropertyBool ACTIVE = PropertyBool.create("active");
private String type;
public IngotBall(Material material, String registryName, Float hardness, String type){
super(material, registryName, hardness);
this.type = type;
this.setTickRandomly(true);
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
if(this.type.equals("chunk")){
return boundBoxSmall;
}else
return boundBoxLarge;
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//System.out.println(stack.getItemDamage());
worldIn.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
//System.out.println(state.getValue(ACTIVE));
}
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
{
if(!world.isRemote){
if(state.getValue(PrimalStates.ACTIVE)){
world.setBlockState(pos, Blocks.FLOWING_LAVA.getDefaultState().withProperty(BlockDynamicLiquid.LEVEL, 1), 3);
}
if(!state.getValue(PrimalStates.ACTIVE)){
//PlayerHelper.spawnItemOnGround(world, pos, new ItemStack(this, 1));
}
}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(PrimalStates.ACTIVE) == false) {
i = 0;
return i;
}
if( state.getValue(PrimalStates.ACTIVE) == true) {
i = 1;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false));
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(true));
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {PrimalStates.ACTIVE});
}
@Override
public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
{
this.updateTick(world, pos, state, random);
if(!world.isRemote){
if ( ThreadLocalRandom.current().nextInt(0,4) == 0) {
if(state.getValue(PrimalStates.ACTIVE) == true) {
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
world.playSound((EntityPlayer) null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1.0F, world.rand.nextFloat() * 0.4F + 0.8F);
}
}
}
}
}

View File

@@ -0,0 +1,488 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModSounds;
import nmd.primal.forgecraft.tiles.TileBloomery;
import nmd.primal.forgecraft.tiles.TileForge;
import nmd.primal.forgecraft.tiles.TilePistonBellows;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import static nmd.primal.core.api.PrimalStates.ACTIVE;
/**
* Created by mminaie on 1/1/17.
*/
public class PistonBellows extends CustomContainerFacing {
//public static final PropertyBool ACTIVE = PropertyBool.create("active");
//protected static final AxisAlignedBB collideBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.99D, 1.0D);
protected static final AxisAlignedBB boundBoxNorth = new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 1.0D, 12 / 16D, 1.0D);
protected static final AxisAlignedBB boundBoxSouth = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.8125D, 12 / 16D, 1.0D);
protected static final AxisAlignedBB boundBoxEast = new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 1.0D, 12 / 16D, 1.0D);
protected static final AxisAlignedBB boundBoxWest = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 12 / 16D, 0.8125D);
public PistonBellows(Material material, String registryName) {
super(material, registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, Boolean.valueOf(false)));
setHardness(3.0f);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TilePistonBellows();
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
TilePistonBellows tile = (TilePistonBellows) worldIn.getTileEntity(pos);
if (tile != null) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(ACTIVE, Boolean.valueOf(false)), 2);
}
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if(!world.isRemote){
//System.out.println(state.getValue(PistonBellows.FACING));
if(state.getValue(ACTIVE) == false) {
world.setBlockState(pos, state.withProperty(ACTIVE, true), 2);
//world.playSound(pos, ForgecraftSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 1.0f, 1.0f);
//world.playSound((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), ModSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 1.0f, 1.0f, true);
world.playSound(null, pos, ModSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 0.25F, 0.8F);
//playSound(@Nullable EntityPlayer player, double x, double y, double z, SoundEvent soundIn, SoundCategory category, float volume, float pitch)
if (state.getValue(PistonBellows.FACING) == EnumFacing.NORTH) {
BlockPos tempPos = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ());
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.EAST)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 50);
tile.updateBlock();
tile.markDirty();
return true;
}
}
}
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true)
&& (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.EAST)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 50);
tile.updateBlock();
tile.markDirty();
return true;
}
}
}
}
if (state.getValue(PistonBellows.FACING) == EnumFacing.SOUTH) {
BlockPos tempPos = new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ());
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.WEST)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 50);
tile.updateBlock();
tile.markDirty();
return true;
}
}
}
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true)
&& (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.WEST)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 50);
tile.updateBlock();
tile.markDirty();
return true;
}
}
}
}
if (state.getValue(PistonBellows.FACING) == EnumFacing.EAST) {
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1);
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.SOUTH)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 50);
tile.updateBlock();
tile.markDirty();
return true;
}
}
}
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true)
&& (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.SOUTH)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 50);
tile.updateBlock();
tile.markDirty();
return true;
}
}
}
}
if (state.getValue(PistonBellows.FACING) == EnumFacing.WEST) {
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1);
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.NORTH)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 50);
tile.updateBlock();
tile.markDirty();
return true;
}
}
}
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true)
&& (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.NORTH)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 50);
tile.updateBlock();
tile.markDirty();
return true;
}
}
}
}
}
}
return true;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
state = state.getActualState(source, pos);
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
switch (enumfacing)
{
case EAST:
default:
return boundBoxEast;
case SOUTH:
return boundBoxSouth;
case WEST:
return boundBoxWest;
case NORTH:
return boundBoxNorth;
}
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
/*if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TilePistonBellows tile = (TilePistonBellows) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}*/
super.breakBlock(world, pos, state);
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(ACTIVE) == false){
i = 0;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(ACTIVE) == false){
i = 1;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(ACTIVE) == false){
i = 2;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(ACTIVE) == false){
i = 3;
return i;
}
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(ACTIVE) == true){
i = 4;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(ACTIVE) == true){
i = 5;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(ACTIVE) == true){
i = 6;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(ACTIVE) == true){
i = 7;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing enumfacing;
Boolean active;
switch (meta & 7)
{
case 0:
enumfacing = EnumFacing.EAST;
active = false;
break;
case 1:
enumfacing = EnumFacing.WEST;
active = false;
break;
case 2:
enumfacing = EnumFacing.SOUTH;
active = false;
break;
case 3:
enumfacing = EnumFacing.NORTH;
active = false;
break;
case 4:
enumfacing = EnumFacing.EAST;
active = true;
break;
case 5:
enumfacing = EnumFacing.WEST;
active = true;
break;
case 6:
enumfacing = EnumFacing.SOUTH;
active = true;
break;
case 7:
enumfacing = EnumFacing.NORTH;
active = true;
break;
default:
enumfacing = EnumFacing.NORTH;
active = false;
}
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(ACTIVE, Boolean.valueOf(active));
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING, ACTIVE});
}
//return new ExtendedBlockState(this, new IProperty[] { BotaniaStateProps.CARDINALS, Properties.StaticProperty }, new IUnlistedProperty[] { Properties.AnimationProperty });
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullyOpaque(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
{
if(state.getValue(ACTIVE) == Boolean.TRUE) {
if (state.getValue(PistonBellows.FACING) == EnumFacing.NORTH) {
BlockPos tempPos = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ());
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.EAST)) {
makeEmbers(world, tempPos, world.rand);
}
}
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.EAST)) {
makeEmbers(world, tempPos, world.rand);
}
}
}
if (state.getValue(PistonBellows.FACING) == EnumFacing.SOUTH) {
BlockPos tempPos = new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ());
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.WEST)) {
makeEmbers(world, tempPos, world.rand);
}
}
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.WEST)) {
makeEmbers(world, tempPos, world.rand);
}
}
}
if (state.getValue(PistonBellows.FACING) == EnumFacing.EAST) {
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1);
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.SOUTH)) {
makeEmbers(world, tempPos, world.rand);
}
}
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.SOUTH)) {
makeEmbers(world, tempPos, world.rand);
}
}
}
if (state.getValue(PistonBellows.FACING) == EnumFacing.WEST) {
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1);
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.NORTH)) {
makeEmbers(world, tempPos, world.rand);
}
}
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.NORTH)) {
makeEmbers(world, tempPos, world.rand);
}
}
}
}
}
private void makeEmbers(World world, BlockPos pos, Random rand){
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.2D;
double d2 = (double)pos.getZ() + 0.5D;
double d3 = 0.52D;
double d4 = ThreadLocalRandom.current().nextDouble(0.066, 0.33);
double ySpeed = ThreadLocalRandom.current().nextDouble(0.05, 0.20);
if(rand.nextInt(3) == 0){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(3) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(3) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(3) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
}
}
/*
if(rand.nextInt(4) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 4){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
}
*/

View File

@@ -0,0 +1,23 @@
package nmd.primal.forgecraft.compat;
/**
* Created by kitsu on 12/3/2016.
*/
//public class FuelHandler implements IFuelHandler {
/*@Override
public int getBurnTime(ItemStack fuelStack)
{
//if (ModConfig.FEATURE_ENABLE_FUELS) {
//CommonUtils.debugLogger(2, "fuel", "size: " + ModRegistries.FUEL_REGISTRY.size() + ", value: " + ModRegistries.FUEL_REGISTRY.get(fuelStack));
for (Map.Entry<ItemStack, Integer> entry : ForgeCraftRegistries.FUEL_REGISTRY.entrySet())
{
if (entry.getKey().isItemEqual(fuelStack))
return entry.getValue();
}
//}
return 0;
}*/
//}

View File

@@ -0,0 +1,15 @@
package nmd.primal.forgecraft.compat;
import mezz.jei.api.BlankModPlugin;
import mezz.jei.api.IModRegistry;
/**
* Created by mminaie on 6/1/17.
*/
public class JEI extends BlankModPlugin
{
@Override
public void register(IModRegistry registry) {
}
}

View File

@@ -0,0 +1,32 @@
package nmd.primal.forgecraft.compat;
import net.minecraftforge.oredict.OreDictionary;
import nmd.primal.forgecraft.init.ModBlocks;
/**
* Created by mminaie on 2/7/17.
*/
public class ModDictionary {/*******************************************************************************
* Register Only Vanilla OreDictionary Entries Here
* Mod Items/Blocks have their names added through the respective
* registration methods as a list of comma delineated strings.
*
* EXAMPLE:
* LEATHER_CORDAGE = registerItem(new PrimalItem("leather_cordage"), "cordageGeneral, cordageLeather");
*
*/
public static void registerDictionaryNames()
{
//if (ModConfig.COMPATIBILITY_DICTIONARY_MAGMACREAM_AS_SLIME)
//OreDictionary.registerOre("clayball", Items.CLAY_BALL);
OreDictionary.registerOre("ingotIron", ModBlocks.ironball);
OreDictionary.registerOre("nuggetIron", ModBlocks.ironchunk);
OreDictionary.registerOre("ingotIron", ModBlocks.ironcleanball);
OreDictionary.registerOre("nuggetIron", ModBlocks.ironcleanchunk);
OreDictionary.registerOre("ingotSteel", ModBlocks.steelball);
OreDictionary.registerOre("nuggetSteel", ModBlocks.steelchunk);
}
}

View File

@@ -0,0 +1,67 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.Arrays;
/**
* Created by mminaie on 3/5/17.
*/
public class AnvilCrafting {
// ***************************************************************************** //
// Recipe Handler AnvilCrafting
// ***************************************************************************** //
private static ArrayList<AnvilCrafting> anvilRecipes = new ArrayList<>();
private String[] input = new String[25];
private String upgradeType;
private ItemStack output;
public AnvilCrafting(String[] input, ItemStack output, String upgrade){
this.input = input;
this.output = output;
this.upgradeType = upgrade;
}
// ***************************************************************************** //
// Recipe Methods
// ***************************************************************************** //
public static void addRecipe(String[] input, ItemStack output, String upgrade)
{
anvilRecipes.add(new AnvilCrafting(input, output, upgrade));
}
public static boolean isRecipe(String[] array)
{
for(AnvilCrafting recipe : anvilRecipes) {
if (Arrays.equals(array, recipe.input))
return true;
}
return false;
}
public static AnvilCrafting getRecipe(String[] array)
{
for(AnvilCrafting recipe : anvilRecipes) {
if (Arrays.equals(array, recipe.input))
return recipe;
}
return null;
}
public String[] getInput() {return this.input;}
public ItemStack getOutput() {return this.output;}
public String getUpgrade() {return this.upgradeType; }
}

View File

@@ -0,0 +1,135 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
/**
* Created by mminaie on 1/24/17.
*/
public class BloomeryCrafting {
// ***************************************************************************** //
// Recipe Handler Bloomery
// ***************************************************************************** //
private static ArrayList<BloomeryCrafting> bloomeryRecipes = new ArrayList<>();
private ItemStack input;
private ItemStack output;
private ItemStack output_failed;
private ItemStack cool_output;
private int heat_threshold;
private int ideal_time;
private int cooldown;
private float heat_variance;
private float time_variance;
public BloomeryCrafting(ItemStack input, ItemStack output, ItemStack output_failed, ItemStack cool_output, int heat_threshold, int ideal_time, int cooldown,float heat_variance, float time_variance)
{
this.input = input;
this.output = output;
this.output_failed = output_failed;
this.cool_output = cool_output;
this.heat_threshold = heat_threshold;
this.ideal_time = ideal_time;
this.cooldown = cooldown;
this.heat_variance = heat_variance;
this.time_variance = time_variance;
}
// ***************************************************************************** //
// Recipe Methods
// ***************************************************************************** //
public static void addRecipe(ItemStack input, ItemStack output, ItemStack failed, ItemStack cool, int heat_threshold, int ideal_time, int cooldown, float heat_variance, float time_variance)
{
bloomeryRecipes.add(new BloomeryCrafting(input, output, failed, cool, heat_threshold, ideal_time, cooldown, heat_variance, time_variance));
}
public static boolean isRecipeItem(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.input))
return true;
}
return false;
}
public static boolean isOutputItem(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.output))
return true;
}
return false;
}
public static boolean isCoolItem(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.cool_output))
return true;
}
return false;
}
public static BloomeryCrafting getRecipe(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.input))
return recipe;
}
return null;
}
public static BloomeryCrafting getRecipeFromOutput(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.output))
return recipe;
}
return null;
}
public ItemStack getInput()
{
return this.input;
}
public ItemStack getOutput()
{
return this.output;
}
public ItemStack getOutputFailed()
{
return this.output_failed;
}
public ItemStack getCoolOutput()
{
return this.cool_output;
}
public int getHeatThreshold()
{
return this.heat_threshold;
}
public int getIdealTime()
{
return this.ideal_time;
}
public int getCooldown(){ return this.cooldown;}
public float getHeatVariance(){return this.heat_variance; }
public float getTimeVariance(){return this.time_variance; }
///
// end
///
}

View File

@@ -0,0 +1,62 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.Arrays;
/**
* Created by mminaie on 6/22/17.
*/
public class CastingformCrafting {
// ***************************************************************************** //
// Recipe Handler AnvilCrafting
// ***************************************************************************** //
private static ArrayList<CastingformCrafting> castingRecipes = new ArrayList<>();
private String[] input = new String[25];
private ItemStack output;
public CastingformCrafting(String[] input, ItemStack output){
this.input = input;
this.output = output;
}
// ***************************************************************************** //
// Recipe Methods
// ***************************************************************************** //
public static void addRecipe(String[] input, ItemStack output)
{
castingRecipes.add(new CastingformCrafting(input, output));
}
public static boolean isRecipe(String[] array)
{
for(CastingformCrafting recipe : castingRecipes) {
if (Arrays.equals(array, recipe.input))
return true;
}
return false;
}
public static CastingformCrafting getRecipe(String[] array)
{
for(CastingformCrafting recipe : castingRecipes) {
if (Arrays.equals(array, recipe.input))
return recipe;
}
return null;
}
public String[] getInput() {return this.input;}
public ItemStack getOutput() {return this.output;}
}

View File

@@ -0,0 +1,97 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
/**
* Created by mminaie on 2/11/17.
*/
public class ForgeCrafting {
// ***************************************************************************** //
// Recipe Handler ForgeCrafting
// ***************************************************************************** //
private static ArrayList<ForgeCrafting> forgeRecipes = new ArrayList<>();
private Item input;
private ItemStack output;
private int heat_threshold;
private int ideal_time;
private int cooldown;
public ForgeCrafting(Item input, ItemStack output, int heat_threshold, int ideal_time, int cooldown, float heat_variance, float time_variance)
{
this.input = input;
this.output = output;
this.heat_threshold = heat_threshold;
this.ideal_time = ideal_time;
this.cooldown = cooldown;
}
// ***************************************************************************** //
// Recipe Methods
// ***************************************************************************** //
public static void addRecipe(Item input, ItemStack output, int heat_threshold, int ideal_time, int cooldown, float heat_variance, float time_variance)
{
forgeRecipes.add(new ForgeCrafting(input, output, heat_threshold, ideal_time, cooldown, heat_variance, time_variance));
}
public static boolean isRecipeItem(Item item)
{
for(ForgeCrafting recipe : forgeRecipes) {
if (item.equals(recipe.input))
return true;
}
return false;
}
public static ForgeCrafting getRecipe(Item item)
{
for(ForgeCrafting recipe : forgeRecipes) {
if (item.equals(recipe.input))
return recipe;
}
return null;
}
/*public static ForgeCrafting getRecipeFromOutput(Item item)
{
for(ForgeCrafting recipe : forgeRecipes) {
if (item.equals(recipe.output))
return recipe;
}
return null;
}*/
public Item getInput()
{
return this.input;
}
public ItemStack getOutput() {return this.output; }
public int getHeatThreshold()
{
return this.heat_threshold;
}
public int getIdealTime()
{
return this.ideal_time;
}
public int getCooldown(){ return this.cooldown;}
///
// end
///
}

View File

@@ -0,0 +1,48 @@
package nmd.primal.forgecraft.enumhandler;
import nmd.primal.forgecraft.util.IMetaLookup;
/**
* Created by mminaie on 2/1/17.
*/
public class EnumHandler {
public enum IngotTypes implements IMetaLookup<IngotTypes> {
IRONCOOL, /*0*/
IRONHOT; /*1*/
public final int meta;
public final String name;
public boolean set = false;
private IngotTypes() {
meta = ordinal();
name = toString().toLowerCase();
}
@Override
public String getVariantName() {
return name;
}
@Override
public int getOrdinal() {
return meta;
}
@Override
public IngotTypes getByOrdinal(int i) {
return this.values()[i];
}
@Override
public String getID() {
return "ore_type";
}
}
}

View File

@@ -0,0 +1,51 @@
package nmd.primal.forgecraft.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import java.io.IOException;
/**
* Created by mminaie on 2/4/17.
*/
public class GuiForgingManual extends GuiScreen {
GuiButton a;
GuiButton b;
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
super.drawScreen(mouseX, mouseY, partialTicks);
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
@Override
public void initGui() {
this.buttonList.add(this.a = new GuiButton(0, this.width / 2 - 100, this.height / 2 - 24, "This is button a"));
this.buttonList.add(this.b = new GuiButton(1, this.width / 2 - 100, this.height / 2 + 4, "This is button b"));
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
if (button == this.a) {
//Main.packetHandler.sendToServer(...);
this.mc.displayGuiScreen(null);
if (this.mc.currentScreen == null)
this.mc.setIngameFocus();
}
if (button == this.b){
//Main.packetHandler.sendToServer(...);
this.mc.displayGuiScreen(null);
if (this.mc.currentScreen == null)
this.mc.setIngameFocus();
}
}
}

View File

@@ -0,0 +1,27 @@
package nmd.primal.forgecraft.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
/**
* Created by mminaie on 2/4/17.
*/
public class GuiHandler implements IGuiHandler {
public static final int FORGINGMANUALGUI = 0;
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
if(ID == FORGINGMANUALGUI){
return new GuiForgingManual();
}
return null;
}
}

View File

@@ -0,0 +1,617 @@
package nmd.primal.forgecraft.init;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.common.items.tools.WorkMallet;
import nmd.primal.forgecraft.blocks.Anvil.AnvilBase;
import nmd.primal.forgecraft.blocks.Anvil.AnvilIron;
import nmd.primal.forgecraft.blocks.Anvil.AnvilStone;
import nmd.primal.forgecraft.blocks.*;
import nmd.primal.forgecraft.blocks.Crucibles.Crucible;
import nmd.primal.forgecraft.blocks.Crucibles.CrucibleHot;
import nmd.primal.forgecraft.items.ForgeHammer;
import nmd.primal.forgecraft.tiles.TileAnvil;
/**
* Created by kitsu on 11/26/2016.
*/
public class ModBlocks {
public static Block forge_brick;
public static Block forge_adobe;
public static Block bloomery_brick;
public static Block bloomery_adobe;
public static Block blockbreaker;
public static Block castingform;
public static Block castingblock;
public static Block pistonbellowsoak;
public static Block pistonbellowsjungle;
public static Block pistonbellowsbirch;
public static Block pistonbellowsspruce;
public static Block pistonbellowsdarkoak;
public static Block pistonbellowsacacia;
public static Block emptycrucible;
public static Block emptycruciblehot;
public static Block emptycruciblecracked;
public static Block emptycruciblecrackedhot;
public static Block rawbronzecrucible;
public static Block hotbronzecrucible;
public static Block hotcookedbronzecrucible;
public static Block rawbronzecrucible_redstone;
public static Block hotbronzecrucible_redstone;
public static Block hotcookedbronzecrucible_redstone;
public static Block rawbronzecrucible_lapis;
public static Block hotbronzecrucible_lapis;
public static Block hotcookedbronzecrucible_lapis;
public static Block rawbronzecrucible_diamond;
public static Block hotbronzecrucible_diamond;
public static Block hotcookedbronzecrucible_diamond;
public static Block rawbronzecrucible_emerald;
public static Block hotbronzecrucible_emerald;
public static Block hotcookedbronzecrucible_emerald;
public static Block rawironcrucible;
public static Block hotironcrucible;
public static Block hotcookedironcrucible;
public static Block coolironcrucible;
public static Block failedironcrucible;
public static Block failedironcruciblehot;
public static Block rawcleanironcrucible;
public static Block hotcleanironcrucible;
public static Block hotcookedcleanironcrucible;
public static Block coolcleanironcrucible;
public static Block failedcleanironcrucible;
public static Block failedcleanironcruciblehot;
public static Block rawsteelcrucible;
public static Block hotsteelcrucible;
public static Block hotcookedsteelcrucible;
public static Block coolsteelcrucible;
public static Block failedsteelcrucible;
public static Block failedsteelcruciblehot;
public static Block rawwootzcrucible;
public static Block hotwootzcrucible;
public static Block hotcookedwootzcrucible;
public static Block coolwootzcrucible;
public static Block failedwootzcrucible;
public static Block failedwootzcruciblehot;
public static Block ironball;
public static Block ironchunk;
public static Block ironcleanball;
public static Block ironcleanchunk;
public static Block steelball;
public static Block steelchunk;
public static Block wootzball;
public static Block wootzchunk;
public static Block stoneanvil;
public static Block ironanvil;
public static void init() {
forge_brick = new Forge(Material.ROCK, "forge_brick", 5000);
forge_adobe = new Forge(Material.ROCK, "forge_adobe", 5000);
bloomery_brick = new BloomeryBase(Material.ROCK, "bloomery_brick", 5000);
bloomery_adobe = new BloomeryBase(Material.ROCK, "bloomery_adobe", 5000);
blockbreaker = new Breaker(Material.WOOD, "blockbreaker", 4.0f);
castingform = new CastingForm(Material.WOOD, "castingform");
castingblock = new CastingBlock(Material.ROCK, "castingblock");
pistonbellowsoak = new PistonBellows(Material.WOOD, "pistonbellowsoak");
pistonbellowsjungle = new PistonBellows(Material.WOOD, "pistonbellowsjungle");
pistonbellowsbirch = new PistonBellows(Material.WOOD, "pistonbellowsbirch");
pistonbellowsspruce = new PistonBellows(Material.WOOD, "pistonbellowsspruce");
pistonbellowsdarkoak = new PistonBellows(Material.WOOD, "pistonbellowsdarkoak");
pistonbellowsacacia = new PistonBellows(Material.WOOD, "pistonbellowsacacia");
emptycrucible = new Crucible(Material.ROCK, "emptycrucible");
emptycruciblehot = new CrucibleHot(Material.ROCK, "emptycruciblehot");
emptycruciblecracked = new Crucible(Material.ROCK, "emptycruciblecracked");
emptycruciblecrackedhot = new CrucibleHot(Material.ROCK, "emptycruciblecrackedhot");
rawbronzecrucible = new Crucible(Material.ROCK, "rawbronzecrucible");
hotbronzecrucible = new CrucibleHot(Material.ROCK, "hotbronzecrucible");
hotcookedbronzecrucible = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible");
rawbronzecrucible_redstone = new Crucible(Material.ROCK, "rawbronzecrucible_redstone");
hotbronzecrucible_redstone = new CrucibleHot(Material.ROCK, "hotbronzecrucible_redstone");
hotcookedbronzecrucible_redstone = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_redstone");
rawbronzecrucible_diamond = new Crucible(Material.ROCK, "rawbronzecrucible_diamond");
hotbronzecrucible_diamond = new CrucibleHot(Material.ROCK, "hotbronzecrucible_diamond");
hotcookedbronzecrucible_diamond = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_diamond");
rawbronzecrucible_lapis = new Crucible(Material.ROCK, "rawbronzecrucible_lapis");
hotbronzecrucible_lapis = new CrucibleHot(Material.ROCK, "hotbronzecrucible_lapis");
hotcookedbronzecrucible_lapis = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_lapis");
rawbronzecrucible_emerald = new Crucible(Material.ROCK, "rawbronzecrucible_emerald");
hotbronzecrucible_emerald = new CrucibleHot(Material.ROCK, "hotbronzecrucible_emerald");
hotcookedbronzecrucible_emerald = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_emerald");
rawironcrucible = new Crucible(Material.ROCK, "rawironcrucible");
hotironcrucible = new CrucibleHot(Material.ROCK, "hotironcrucible");
hotcookedironcrucible = new CrucibleHot(Material.ROCK, "hotcookedironcrucible");
coolironcrucible = new Crucible(Material.ROCK, "coolironcrucible");
failedironcrucible = new Crucible(Material.ROCK, "failedironcrucible");
failedironcruciblehot = new CrucibleHot(Material.ROCK, "failedironcruciblehot");
rawcleanironcrucible = new Crucible(Material.ROCK, "rawcleanironcrucible");
hotcleanironcrucible = new CrucibleHot(Material.ROCK, "hotcleanironcrucible");
hotcookedcleanironcrucible = new CrucibleHot(Material.ROCK, "hotcookedcleanironcrucible");
coolcleanironcrucible = new Crucible(Material.ROCK, "coolcleanironcrucible");
failedcleanironcrucible = new Crucible(Material.ROCK, "failedcleanironcrucible");
failedcleanironcruciblehot = new Crucible(Material.ROCK, "failedcleanironcruciblehot");
rawsteelcrucible = new Crucible(Material.ROCK, "rawsteelcrucible");
hotsteelcrucible = new CrucibleHot(Material.ROCK, "hotsteelcrucible");
hotcookedsteelcrucible = new CrucibleHot(Material.ROCK, "hotcookedsteelcrucible");
coolsteelcrucible = new Crucible(Material.ROCK, "coolsteelcrucible");
failedsteelcrucible = new Crucible(Material.ROCK, "failedsteelcrucible");
failedsteelcruciblehot = new Crucible(Material.ROCK, "failedsteelcruciblehot");
rawwootzcrucible = new Crucible(Material.ROCK, "rawwootzcrucible");
hotwootzcrucible = new CrucibleHot(Material.ROCK, "hotwootzcrucible");
hotcookedwootzcrucible = new CrucibleHot(Material.ROCK, "hotcookedwootzcrucible");
coolwootzcrucible = new Crucible(Material.ROCK, "coolwootzcrucible");
failedwootzcrucible = new Crucible(Material.ROCK, "failedwootzcrucible");
failedwootzcruciblehot = new Crucible(Material.ROCK, "failedwootzcruciblehot");
ironball = new IngotBall(Material.IRON, "ironball", 5.0F, "ingot") {
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz)
{
if(!world.isRemote){
Item pItem = player.getHeldItem(hand).getItem();
BlockPos belowPos = pos.down();
//System.out.println("Activating");
if (pItem instanceof WorkMallet && world.getBlockState(belowPos).getBlock().equals(Blocks.STONE)) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(belowPos, ModBlocks.stoneanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
world.playEvent(1031, pos, 0);
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
return true;
}
/*if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
world.playEvent(1031, pos, 0);
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
return true;
}*/
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
if (tile.getSlotStack(6).isEmpty() &&
tile.getSlotStack(7).isEmpty() &&
tile.getSlotStack(8).isEmpty() &&
tile.getSlotStack(11).isEmpty() &&
tile.getSlotStack(12).isEmpty() &&
tile.getSlotStack(13).isEmpty() &&
tile.getSlotStack(16).isEmpty() &&
tile.getSlotStack(17).isEmpty() &&
tile.getSlotStack(18).isEmpty()
) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
tile.setSlotStack(6, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(7, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(8, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(11, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(12, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(13, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(16, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(17, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(18, new ItemStack(ModItems.ironchunkhot, 1));
world.playEvent(1031, pos, 0);
return true;
}
}
}
}
return false;
}
};
ironcleanball = new IngotBall(Material.IRON, "ironcleanball", 5.0f, "ingot") {
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz)
{
//System.out.println("Level 0");
if(!world.isRemote){
Item pItem = player.getHeldItem(hand).getItem();
BlockPos belowPos = pos.down();
//System.out.println("Activating1");
if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
world.playEvent(1031, pos, 0);
//System.out.println("Activating");
return true;
}
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
if (tile.getSlotStack(6).isEmpty() &&
tile.getSlotStack(7).isEmpty() &&
tile.getSlotStack(8).isEmpty() &&
tile.getSlotStack(11).isEmpty() &&
tile.getSlotStack(12).isEmpty() &&
tile.getSlotStack(13).isEmpty() &&
tile.getSlotStack(16).isEmpty() &&
tile.getSlotStack(17).isEmpty() &&
tile.getSlotStack(18).isEmpty()
) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
tile.setSlotStack(6, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(7, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(8, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(11, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(12, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(13, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(16, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(17, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(18, new ItemStack(ModItems.ironcleanchunkhot, 1));
world.playEvent(1031, pos, 0);
return true;
}
}
}
}
return false;
}
}; // clean_iron_ingot ironcleanball.json ironcleanballhot.json - done
steelball = new IngotBall(Material.IRON, "steelball", 6.0f, "ingot"){
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz)
{
if(!world.isRemote){
Item pItem = player.getHeldItem(hand).getItem();
BlockPos belowPos = pos.down();
//System.out.println("Activating");
if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
world.playEvent(1031, pos, 0);
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
return true;
}
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
if (tile.getSlotStack(6).isEmpty() &&
tile.getSlotStack(7).isEmpty() &&
tile.getSlotStack(8).isEmpty() &&
tile.getSlotStack(11).isEmpty() &&
tile.getSlotStack(12).isEmpty() &&
tile.getSlotStack(13).isEmpty() &&
tile.getSlotStack(16).isEmpty() &&
tile.getSlotStack(17).isEmpty() &&
tile.getSlotStack(18).isEmpty()
) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
tile.setSlotStack(6, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(7, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(8, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(11, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(12, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(13, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(16, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(17, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(18, new ItemStack(ModItems.steelchunkhot, 1));
world.playEvent(1031, pos, 0);
return true;
}
}
}
}
return false;
}
}; // steel_ingot steelball.json steelballhot.json
wootzball = new IngotBall(Material.IRON, "wootzball", 6.0f, "ingot") {
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz)
{
if(!world.isRemote){
Item pItem = player.getHeldItem(hand).getItem();
BlockPos belowPos = pos.down();
//System.out.println("Activating");
if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
world.playEvent(1031, pos, 0);
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
return true;
}
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
if (tile.getSlotStack(6).isEmpty() &&
tile.getSlotStack(7).isEmpty() &&
tile.getSlotStack(8).isEmpty() &&
tile.getSlotStack(11).isEmpty() &&
tile.getSlotStack(12).isEmpty() &&
tile.getSlotStack(13).isEmpty() &&
tile.getSlotStack(16).isEmpty() &&
tile.getSlotStack(17).isEmpty() &&
tile.getSlotStack(18).isEmpty()
) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
tile.setSlotStack(6, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(7, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(8, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(11, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(12, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(13, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(16, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(17, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(18, new ItemStack(ModItems.wootzchunkhot, 1));
world.playEvent(1031, pos, 0);
return true;
}
}
}
}
return false;
}
}; //wootz_ingot wootzball.json wootzballhot.json
ironchunk = new IngotBall(Material.IRON, "ironchunk", 5.0F, "chunk");
ironcleanchunk = new IngotBall(Material.IRON, "ironcleanchunk", 5.0F, "chunk"); //Lyle to make assets clean_iron_ingot, blockstate\ironcleanchunk.json, item\ironcleanchunk.json, item\ironcleanchunkhot.json - done
steelchunk = new IngotBall(Material.IRON, "steelchunk", 6.0f, "chunk"); //steel_ingot steelchunk.json steelchunkhot.json - done
wootzchunk = new IngotBall(Material.IRON, "wootzchunk", 6.0f, "chunk"); //wootz_ingot wootzchunk.json wootzchunkhot.json - done
stoneanvil = new AnvilStone(Material.ANVIL, "stoneanvil", 5.0f, true);
ironanvil = new AnvilIron(Material.ANVIL, "ironanvil", 6.0f, true);
//ironballitemcool = new ItemBlockIngotBall(ironball);
//ironballitemhot = new ItemBlockIngotBall(ironball);
}
public static void register() {
registerBlock(forge_brick);
registerBlock(forge_adobe);
registerBlock(bloomery_brick);
registerBlock(bloomery_adobe);
registerBlock(blockbreaker);
registerBlock(castingform);
registerBlock(castingblock);
registerBlock(pistonbellowsoak);
registerBlock(pistonbellowsjungle);
registerBlock(pistonbellowsbirch);
registerBlock(pistonbellowsspruce);
registerBlock(pistonbellowsdarkoak);
registerBlock(pistonbellowsacacia);
registerBlock(emptycrucible);
registerBlock(emptycruciblehot);
registerBlock(emptycruciblecracked);
registerBlock(emptycruciblecrackedhot);
registerBlock(rawbronzecrucible);
registerBlock(hotbronzecrucible);
registerBlock(hotcookedbronzecrucible);
registerBlock(rawbronzecrucible_diamond);
registerBlock(hotbronzecrucible_diamond);
registerBlock(hotcookedbronzecrucible_diamond);
registerBlock(rawbronzecrucible_emerald);
registerBlock(hotbronzecrucible_emerald);
registerBlock(hotcookedbronzecrucible_emerald);
registerBlock(rawbronzecrucible_redstone);
registerBlock(hotbronzecrucible_redstone);
registerBlock(hotcookedbronzecrucible_redstone);
registerBlock(rawbronzecrucible_lapis);
registerBlock(hotbronzecrucible_lapis);
registerBlock(hotcookedbronzecrucible_lapis);
registerBlock(rawironcrucible);
registerBlock(hotironcrucible);
registerBlock(hotcookedironcrucible);
registerBlock(coolironcrucible);
registerBlock(failedironcrucible);
registerBlock(failedironcruciblehot);
registerBlock(rawcleanironcrucible);
registerBlock(hotcleanironcrucible);
registerBlock(hotcookedcleanironcrucible);
registerBlock(coolcleanironcrucible);
registerBlock(failedcleanironcrucible);
registerBlock(failedcleanironcruciblehot);
registerBlock(rawsteelcrucible);
registerBlock(hotsteelcrucible);
registerBlock(hotcookedsteelcrucible);
registerBlock(coolsteelcrucible);
registerBlock(failedsteelcrucible);
registerBlock(failedsteelcruciblehot);
registerBlock(rawwootzcrucible);
registerBlock(hotwootzcrucible);
registerBlock(hotcookedwootzcrucible);
registerBlock(coolwootzcrucible);
registerBlock(failedwootzcrucible);
registerBlock(failedwootzcruciblehot);
registerBlock(ironball);
registerBlock(ironchunk);
registerBlock(ironcleanball);
registerBlock(ironcleanchunk);
registerBlock(steelball);
registerBlock(steelchunk);
registerBlock(wootzball);
registerBlock(wootzchunk);
//registerBlockSubType(ironball, ironballitemcool, "ironcool");
//registerBlockSubType(ironball, ironballitemhot, "ironhot");
registerBlock(stoneanvil);
registerBlock(ironanvil);
}
@SideOnly(Side.CLIENT)
public static void registerRenders() {
registerRender(forge_brick);
registerRender(forge_adobe);
registerRender(castingform);
registerRender(castingblock);
registerRender(blockbreaker);
registerRender(pistonbellowsoak);
registerRender(pistonbellowsjungle);
registerRender(pistonbellowsbirch);
registerRender(pistonbellowsspruce);
registerRender(pistonbellowsdarkoak);
registerRender(pistonbellowsacacia);
registerRender(bloomery_brick);
registerRender(bloomery_adobe);
registerRender(emptycrucible);
registerRender(emptycruciblehot);
registerRender(emptycruciblecracked);
registerRender(emptycruciblecrackedhot);
registerRender(rawbronzecrucible);
registerRender(hotbronzecrucible);
registerRender(hotcookedbronzecrucible);
registerRender(rawbronzecrucible_diamond);
registerRender(hotbronzecrucible_diamond);
registerRender(hotcookedbronzecrucible_diamond);
registerRender(rawbronzecrucible_emerald);
registerRender(hotbronzecrucible_emerald);
registerRender(hotcookedbronzecrucible_emerald);
registerRender(rawbronzecrucible_redstone);
registerRender(hotbronzecrucible_redstone);
registerRender(hotcookedbronzecrucible_redstone);
registerRender(rawbronzecrucible_lapis);
registerRender(hotbronzecrucible_lapis);
registerRender(hotcookedbronzecrucible_lapis);
registerRender(rawironcrucible);
registerRender(hotironcrucible);
registerRender(hotcookedironcrucible);
registerRender(coolironcrucible);
registerRender(failedironcrucible);
registerRender(failedironcruciblehot);
registerRender(rawcleanironcrucible);
registerRender(hotcleanironcrucible);
registerRender(hotcookedcleanironcrucible);
registerRender(coolcleanironcrucible);
registerRender(failedcleanironcrucible);
registerRender(failedcleanironcruciblehot);
registerRender(rawsteelcrucible);
registerRender(hotsteelcrucible);
registerRender(hotcookedsteelcrucible);
registerRender(coolsteelcrucible);
registerRender(failedsteelcrucible);
registerRender(failedsteelcruciblehot);
registerRender(rawwootzcrucible);
registerRender(hotwootzcrucible);
registerRender(hotcookedwootzcrucible);
registerRender(coolwootzcrucible);
registerRender(failedwootzcrucible);
registerRender(failedwootzcruciblehot);
registerRender(ironball);
registerRender(ironchunk);
registerRender(ironcleanball);
registerRender(ironcleanchunk);
registerRender(steelball);
registerRender(steelchunk);
registerRender(wootzball);
registerRender(wootzchunk);
//registerRenderCustom(ironballitemcool, 0, new ModelResourceLocation(ironballitemcool.getUnlocalizedName()));
//registerRenderCustom(ironballitemhot, 1, new ModelResourceLocation(ironballitemhot.getUnlocalizedName()));
registerRender(stoneanvil);
registerRender(ironanvil);
}
private static void registerBlock(Block block) {
GameRegistry.register(block);
ItemBlock item = new ItemBlock(block);
item.setRegistryName(block.getRegistryName());
GameRegistry.register(item);
}
private static void registerBlockSubType(Block block, ItemBlock itemBlock, String registryName){
GameRegistry.register(block);
ItemBlock item = itemBlock;
item.setRegistryName(registryName);
GameRegistry.register(item);
}
private static void registerRender(Block block) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
}
private static void registerRenderCustom(ItemBlock item, Integer meta, ModelResourceLocation model){
ModelLoader.setCustomModelResourceLocation(item, meta, model);
}
}

View File

@@ -0,0 +1,47 @@
package nmd.primal.forgecraft.init;
import net.minecraftforge.common.config.Config;
import nmd.primal.forgecraft.ForgeCraft;
import nmd.primal.forgecraft.ModInfo;
@Config(modid = ModInfo.MOD_ID, name = ModInfo.MOD_CONFIG, category = "")
@Config.LangKey("forgecraft.config.title")
@SuppressWarnings("unused")
public class ModConfig
{
static {
ForgeCraft.LOGGER.info("Loading Config File: " + ModInfo.MOD_CONFIG + ".cfg");
}
/**
* Main Config Sections
*/
public static Compatibility compatibility;
public static ModConfig.Features features;
/**
* Options related to compatibility with mods and vanilla features
*/
public static class Compatibility
{
@Config.Comment({"Ore Dictionary Wootz steel for compatibility with common mod steel"})
public static boolean COMPAT_DICTIONARY_WOOTZ_STEEL;
}
/**
* Customize main features of the mod
*/
public static class Features
{
@Config.Comment({"Smoke is produced from various forge blocks when active"})
public static boolean FEATURE_ENABLE_SMOKE = true;
@Config.RequiresMcRestart
@Config.Comment({"Various forge blocks will set fire to their surroundings when active"})
public static boolean FEATURE_ENABLE_FIRE = true;
@Config.Comment({"Sample config for a numeric range"})
@Config.RangeInt(min = 0, max = 1000)
public static int FEATURE_HEAT_RANGE = 0;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
package nmd.primal.forgecraft.init;
import net.minecraftforge.common.MinecraftForge;
import nmd.primal.forgecraft.CommonEvents;
/**
* Created by mminaie on 3/15/17.
*/
public class ModEvents {
public static void registerCommonEvents()
{
MinecraftForge.EVENT_BUS.register(new CommonEvents());
}
}

View File

@@ -0,0 +1,634 @@
package nmd.primal.forgecraft.init;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalMaterials;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.items.*;
import nmd.primal.forgecraft.items.casting.CastingPart;
import nmd.primal.forgecraft.items.parts.BronzeToolPart;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.items.tools.*;
import nmd.primal.forgecraft.items.weapons.CustomShield;
import nmd.primal.forgecraft.items.weapons.CustomSword;
import nmd.primal.forgecraft.items.weapons.SlayerSword;
/**
* Created by kitsu on 11/26/2016.
*/
public class ModItems {
//public static Item test;
public static Item bellowshandle;
public static Item forgehammer;
public static Item softcrucible;
public static Item stonetongs;
public static Item castingmud;
public static Item ironingotballhot;
public static Item ironchunkhot;
public static Item ironcleaningotballhot;
public static Item ironcleanchunkhot;
public static Item steelingotballhot;
public static Item steelchunkhot;
public static Item wootzingotballhot;
public static Item wootzchunkhot;
public static Item cast_axe;
public static Item cast_gladius;
public static Item cast_hoe;
public static Item cast_pickaxe;
public static Item cast_shovel;
public static Item pickaxehead;
public static Item ironaxehead;
public static Item ironshovelhead;
public static Item ironhoehead;
public static Item cleanironpickaxehead;
public static Item cleanironaxehead;
public static Item cleanironshovelhead;
public static Item cleanironhoehead;
public static Item steelpickaxehead;
public static Item steelaxehead;
public static Item steelshovelhead;
public static Item steelhoehead;
public static Item wootzpickaxehead;
public static Item wootzaxehead;
public static Item wootzshovelhead;
public static Item wootzhoehead;
public static Item bronzepickaxehead;
public static Item bronzeaxehead;
public static Item bronzeshovelhead;
public static Item bronzehoehead;
public static Item bronzepickaxe;
public static Item bronzeaxe;
public static Item bronzeshovel;
public static Item bronzehoe;
public static Item ironpickaxe;
public static Item ironaxe;
public static Item ironshovel;
public static Item ironhoe;
public static Item cleanironpickaxe;
public static Item cleanironaxe;
public static Item cleanironshovel;
public static Item cleanironhoe;
public static Item steelpickaxe;
public static Item steelaxe;
public static Item steelshovel;
public static Item steelhoe;
public static Item wootzpickaxe;
public static Item wootzaxe;
public static Item wootzshovel;
public static Item wootzhoe;
public static Item bronzegladius;
public static Item wroughtirongladius;
public static Item cleanirongladius;
public static Item steelgladius;
public static Item cleanironlongsword;
public static Item steellongsword;
public static Item wroughtironslayer;
public static Item cleanironslayer;
public static Item steelslayer;
public static Item wroughtironshield;
//public static Item cleanironshield;
//public static Item steelshield;
//public static Item wootzshield;
public static Item matchlockmusket;
//public static Item forgingmanual;
public static void init() {
//OBJLoader.INSTANCE.addDomain(ModInfo.MOD_ID);
//pistonbellows = new ItemBellowsHandle("pistonbellows");
bellowshandle = new BaseItem("bellowshandle");
softcrucible = new ItemSoftCrucible("softcrucible");
stonetongs = new ItemStoneTongs("stonetongs");
forgehammer = new ForgeHammer("forgehammer");
castingmud = new BaseItem("castingmud");
//matchlockmusket = new Musket("matchlock_musket");
/**********
CASTING PARTS
**********/
cast_axe = new CastingPart("cast_axe");
cast_gladius = new CastingPart("cast_gladius");
cast_hoe = new CastingPart("cast_hoe");
cast_pickaxe = new CastingPart("cast_pickaxe");
cast_shovel = new CastingPart("cast_shovel");
/**********
TOOL PARTS
**********/
bronzepickaxehead = new BronzeToolPart("bronzepickaxehead", PrimalMaterials.TOOL_BRONZE, 41);
bronzeaxehead = new BronzeToolPart("bronzeaxehead", PrimalMaterials.TOOL_BRONZE, 42);
bronzeshovelhead = new BronzeToolPart("bronzeshovelhead", PrimalMaterials.TOOL_BRONZE, 43);
bronzehoehead = new BronzeToolPart("bronzehoehead", PrimalMaterials.TOOL_BRONZE, 44);
pickaxehead = new ToolPart("ironpickaxehead", PrimalMaterials.TOOL_WROUGHT_IRON, 8);
ironaxehead = new ToolPart("ironaxehead", PrimalMaterials.TOOL_WROUGHT_IRON, 9);
ironshovelhead = new ToolPart("ironshovelhead", PrimalMaterials.TOOL_WROUGHT_IRON, 10);
ironhoehead = new ToolPart("ironhoehead", PrimalMaterials.TOOL_WROUGHT_IRON, 11);
cleanironpickaxehead = new ToolPart("cleanironpickaxehead", PrimalMaterials.TOOL_CLEAN_IRON, 17);
cleanironaxehead = new ToolPart("cleanironaxehead", PrimalMaterials.TOOL_CLEAN_IRON, 18);
cleanironshovelhead = new ToolPart("cleanironshovelhead", PrimalMaterials.TOOL_CLEAN_IRON, 19);
cleanironhoehead = new ToolPart("cleanironhoehead", PrimalMaterials.TOOL_CLEAN_IRON, 20);
steelpickaxehead = new ToolPart("steelpickaxehead", PrimalMaterials.TOOL_BASIC_STEEL, 26);
steelaxehead = new ToolPart("steelaxehead", PrimalMaterials.TOOL_BASIC_STEEL, 27);
steelshovelhead = new ToolPart("steelshovelhead", PrimalMaterials.TOOL_BASIC_STEEL, 28);
steelhoehead = new ToolPart("steelhoehead", PrimalMaterials.TOOL_BASIC_STEEL, 29);
wootzpickaxehead = new ToolPart("wootzpickaxehead", PrimalMaterials.TOOL_WOOTZ_STEEL, 35);
wootzaxehead = new ToolPart("wootzaxehead", PrimalMaterials.TOOL_WOOTZ_STEEL, 36);
wootzshovelhead = new ToolPart("wootzshovelhead", PrimalMaterials.TOOL_WOOTZ_STEEL, 37);
wootzhoehead = new ToolPart("wootzhoehead", PrimalMaterials.TOOL_WOOTZ_STEEL, 38);
/**********
TOOLS
**********/
bronzepickaxe = new BronzePickaxe("bronzepickaxe", PrimalMaterials.TOOL_BRONZE);
bronzeaxe = new BronzeAxe("bronzeaxe", PrimalMaterials.TOOL_BRONZE);
bronzeshovel = new BronzeShovel("bronzeshovel", PrimalMaterials.TOOL_BRONZE);
bronzehoe = new BronzeHoe("bronzehoe", PrimalMaterials.TOOL_BRONZE);
ironpickaxe = new CustomPickaxe("ironpickaxe", PrimalMaterials.TOOL_WROUGHT_IRON);
ironaxe = new CustomAxe("ironaxe", PrimalMaterials.TOOL_WROUGHT_IRON);
ironshovel = new CustomShovel("ironshovel", PrimalMaterials.TOOL_WROUGHT_IRON);
ironhoe = new CustomHoe("ironhoe", PrimalMaterials.TOOL_WROUGHT_IRON);
cleanironpickaxe = new CustomPickaxe("cleanironpickaxe", PrimalMaterials.TOOL_CLEAN_IRON);
cleanironaxe = new CustomAxe("cleanironaxe", PrimalMaterials.TOOL_CLEAN_IRON);
cleanironshovel = new CustomShovel("cleanironshovel", PrimalMaterials.TOOL_CLEAN_IRON);
cleanironhoe = new CustomHoe("cleanironhoe", PrimalMaterials.TOOL_CLEAN_IRON);
steelpickaxe = new CustomPickaxe("steelpickaxe", PrimalMaterials.TOOL_BASIC_STEEL);
steelaxe = new CustomAxe("steelaxe", PrimalMaterials.TOOL_BASIC_STEEL);
steelshovel = new CustomShovel("steelshovel", PrimalMaterials.TOOL_BASIC_STEEL);
steelhoe = new CustomHoe("steelhoe", PrimalMaterials.TOOL_BASIC_STEEL);
wootzpickaxe = new CustomPickaxe("wootzpickaxe", PrimalMaterials.TOOL_WOOTZ_STEEL);
wootzaxe = new CustomAxe("wootzaxe", PrimalMaterials.TOOL_WOOTZ_STEEL);
wootzshovel = new CustomShovel("wootzshovel", PrimalMaterials.TOOL_WOOTZ_STEEL);
wootzhoe = new CustomHoe("wootzhoe", PrimalMaterials.TOOL_WOOTZ_STEEL);
/**********
WEAPONS
**********/
bronzegladius = new CustomSword("bronzegladius", PrimalMaterials.TOOL_BRONZE, 5D, 2D);
wroughtirongladius = new CustomSword("wroughtirongladius", PrimalMaterials.TOOL_WROUGHT_IRON, 4.5D, -1.85D);
cleanirongladius = new CustomSword("cleanirongladius", PrimalMaterials.TOOL_CLEAN_IRON, 5D, -1.85D);
steelgladius = new CustomSword("steelgladius", PrimalMaterials.TOOL_BASIC_STEEL,6D, -1.85D);
cleanironlongsword = new CustomSword("cleanironlongsword", PrimalMaterials.TOOL_CLEAN_IRON, 7D, -2.5D);
steellongsword = new CustomSword("steellongsword", PrimalMaterials.TOOL_BASIC_STEEL,8D, -2.25D);
wroughtironslayer = new SlayerSword("wroughtironslayer", PrimalMaterials.TOOL_WROUGHT_IRON, 11.5D, -3.7D);
cleanironslayer = new SlayerSword("cleanironslayer", PrimalMaterials.TOOL_CLEAN_IRON, 10D, -3.5D);
steelslayer = new SlayerSword("steelslayer", PrimalMaterials.TOOL_BASIC_STEEL,11D, -3.3D);
wroughtironshield = new CustomShield("wroughtironshield", PrimalMaterials.TOOL_WROUGHT_IRON);
/**********
INGOTS AND CHUNKS
**********/
ironingotballhot = new BaseMultiItem("ironingothot", PrimalMaterials.TOOL_WROUGHT_IRON, 6);
ironchunkhot = new BaseMultiItem("ironchunkhot", PrimalMaterials.TOOL_WROUGHT_IRON, 7);
ironcleaningotballhot= new BaseMultiItem("ironcleaningotballhot", PrimalMaterials.TOOL_CLEAN_IRON, 15);
ironcleanchunkhot= new BaseMultiItem("ironcleanchunkhot", PrimalMaterials.TOOL_CLEAN_IRON, 16);
steelingotballhot= new BaseMultiItem("steelingotballhot", PrimalMaterials.TOOL_BASIC_STEEL, 24);
steelchunkhot= new BaseMultiItem("steelchunkhot", PrimalMaterials.TOOL_BASIC_STEEL, 25);
wootzingotballhot= new BaseMultiItem("wootzingotballhot", PrimalMaterials.TOOL_WOOTZ_STEEL, 33);
wootzchunkhot= new BaseMultiItem("wootzchunkhot", PrimalMaterials.TOOL_WOOTZ_STEEL, 34);
//forgingmanual = new ItemForgingManual();
//test = new ItemTest("ironsword");
}
public static void register() {
GameRegistry.register(castingmud);
GameRegistry.register(bellowshandle);
GameRegistry.register(softcrucible);
GameRegistry.register(stonetongs);
GameRegistry.register(forgehammer);
GameRegistry.register(ironingotballhot);
GameRegistry.register(ironchunkhot);
GameRegistry.register(ironcleaningotballhot);
GameRegistry.register(ironcleanchunkhot);
GameRegistry.register(steelingotballhot);
GameRegistry.register(steelchunkhot);
GameRegistry.register(wootzingotballhot);
GameRegistry.register(wootzchunkhot);
//GameRegistry.register(test);
/**********
CASTING PARTS
**********/
GameRegistry.register(cast_axe);
GameRegistry.register(cast_gladius);
GameRegistry.register(cast_hoe);
GameRegistry.register(cast_pickaxe);
GameRegistry.register(cast_shovel);
/**********
TOOL PARTS
**********/
GameRegistry.register(bronzepickaxehead);
GameRegistry.register(bronzeaxehead);
GameRegistry.register(bronzeshovelhead);
GameRegistry.register(bronzehoehead);
GameRegistry.register(pickaxehead);
GameRegistry.register(ironaxehead);
GameRegistry.register(ironshovelhead);
GameRegistry.register(ironhoehead);
GameRegistry.register(cleanironpickaxehead);
GameRegistry.register(cleanironaxehead);
GameRegistry.register(cleanironshovelhead);
GameRegistry.register(cleanironhoehead);
GameRegistry.register(steelpickaxehead);
GameRegistry.register(steelaxehead);
GameRegistry.register(steelshovelhead);
GameRegistry.register(steelhoehead);
GameRegistry.register(wootzpickaxehead);
GameRegistry.register(wootzaxehead);
GameRegistry.register(wootzshovelhead);
GameRegistry.register(wootzhoehead);
/**********
TOOLS
**********/
GameRegistry.register(bronzepickaxe);
GameRegistry.register(bronzeaxe);
GameRegistry.register(bronzeshovel);
GameRegistry.register(bronzehoe);
GameRegistry.register(ironpickaxe);
GameRegistry.register(ironaxe);
GameRegistry.register(ironshovel);
GameRegistry.register(ironhoe);
GameRegistry.register(cleanironpickaxe);
GameRegistry.register(cleanironaxe);
GameRegistry.register(cleanironshovel);
GameRegistry.register(cleanironhoe);
GameRegistry.register(steelpickaxe);
GameRegistry.register(steelaxe);
GameRegistry.register(steelshovel);
GameRegistry.register(steelhoe);
GameRegistry.register(wootzpickaxe);
GameRegistry.register(wootzaxe);
GameRegistry.register(wootzshovel);
GameRegistry.register(wootzhoe);
/**********
WEAPONS
**********/
GameRegistry.register(wroughtirongladius);
GameRegistry.register(bronzegladius);
GameRegistry.register(cleanirongladius);
GameRegistry.register(steelgladius);
GameRegistry.register(cleanironlongsword);
GameRegistry.register(steellongsword);
GameRegistry.register(wroughtironslayer);
GameRegistry.register(cleanironslayer);
GameRegistry.register(steelslayer);
//GameRegistry.register(matchlockmusket);
//GameRegistry.register(forgingmanual);
}
@SideOnly(Side.CLIENT)
public static void registerRenders() {
registerRender(castingmud);
registerRender(bellowshandle);
registerRender(softcrucible);
registerRender(forgehammer);
registerRender(ironingotballhot);
registerRender(ironchunkhot);
registerRender(ironcleaningotballhot);
registerRender(ironcleanchunkhot);
registerRender(steelingotballhot);
registerRender(steelchunkhot);
//registerRender(test);
/**********
CASTING PARTS
**********/
registerRender(cast_axe);
registerRender(cast_gladius);
registerRender(cast_hoe);
registerRender(cast_pickaxe);
registerRender(cast_shovel);
/**********
TOOL PARTS
**********/
registerRender(bronzepickaxehead);
registerRender(bronzeaxehead);
registerRender(bronzeshovelhead);
registerRender(bronzehoehead);
registerRender(pickaxehead);
registerRender(ironaxehead);
registerRender(ironshovelhead);
registerRender(ironhoehead);
registerRender(cleanironpickaxehead);
registerRender(cleanironaxehead);
registerRender(cleanironshovelhead);
registerRender(cleanironhoehead);
registerRender(steelpickaxehead);
registerRender(steelaxehead);
registerRender(steelshovelhead);
registerRender(steelhoehead);
registerRender(wootzpickaxehead);
registerRender(wootzaxehead);
registerRender(wootzshovelhead);
registerRender(wootzhoehead);
/**********
TOOLS
**********/
registerRender(bronzepickaxe);
registerRender(bronzeaxe);
registerRender(bronzeshovel);
registerRender(bronzehoe);
registerRender(ironpickaxe);
registerRender(ironaxe);
registerRender(ironshovel);
registerRender(ironhoe);
registerRender(cleanironpickaxe);
registerRender(cleanironaxe);
registerRender(cleanironshovel);
registerRender(cleanironhoe);
registerRender(steelpickaxe);
registerRender(steelaxe);
registerRender(steelshovel);
registerRender(steelhoe);
registerRender(wootzpickaxe);
registerRender(wootzaxe);
registerRender(wootzshovel);
registerRender(wootzhoe);
/**********
WEAPONS
**********/
registerRender(wroughtironshield);
registerRender(bronzegladius);
registerRender(wroughtirongladius);
registerRender(cleanirongladius);
registerRender(steelgladius);
registerRender(cleanironlongsword);
registerRender(steellongsword);
registerRender(wroughtironslayer);
registerRender(cleanironslayer);
registerRender(steelslayer);
//registerRender(forgingmanual);
//registerRender(matchlockmusket);
}
@SideOnly(Side.CLIENT)
public static void registerCustomRenders(){
ModelBakery.registerItemVariants(ModItems.stonetongs, ModItems.stonetongs.getRegistryName(),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_default"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_emptyhot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_emptyhotcracked"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotiron"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotironcooked"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotironfailed"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_ingot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_chunk"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_pickaxe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_axe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_shovel_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hoe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotcleaniron"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotcleanironcooked"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotcleanironfailed"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleanironingot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleanironchunk"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleaniron_pickaxe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleaniron_axe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleaniron_shovel_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleaniron_hoe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotsteel"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotsteelcooked"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotsteelfailed"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steelingot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steelchunk"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steel_pickaxe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steel_axe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steel_shovel_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steel_hoe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze_lapis"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked_lapis"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze_redstone"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked_redstone"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze_emerald"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked_emerald"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze_diamond"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked_diamond")
);
ModelLoader.setCustomMeshDefinition(ModItems.stonetongs, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
if (stack.hasTagCompound()) {
if (stack.getTagCompound().getInteger("type") == 0 ){
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_default", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 1 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_emptyhot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 2 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_emptyhotcracked", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 3 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotiron", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 4 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotironcooked", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 5 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotironfailed", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 6 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_ingot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 7 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_chunk", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 8 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_pickaxe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 9 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_axe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 10 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_shovel_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 11 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hoe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 12 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotcleaniron", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 13 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotcleanironcooked", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 14 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotcleanironfailed", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 15 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleanironingot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 16 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleanironchunk", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 17 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleaniron_pickaxe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 18 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleaniron_axe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 19 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleaniron_shovel_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 20 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleaniron_hoe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 21 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotsteel", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 22 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotsteelcooked", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 23 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotsteelfailed", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 24 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steelingot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 25 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steelchunk", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 26 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steel_pickaxe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 27 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steel_axe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 28 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steel_shovel_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 29 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steel_hoe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 39 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 40 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 45 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze_emerald", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 46 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked_emerald", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 47 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze_diamond", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 48 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked_diamond", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 49 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze_redstone", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 50 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked_redstone", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 51 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze_lapis", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 52 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked_lapis", "inventory");
}
else return new ModelResourceLocation(stack.getItem().getRegistryName(), "inventory");
}
return new ModelResourceLocation(stack.getItem().getRegistryName(), "inventory");
}
});
}
private static void registerRender(Item item) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
}
private static void registerRenderItemBlock(ItemBlock item){
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
}
/*public static void registerRender(Item item, int meta, String fileName) {
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(new ResourceLocation(fileName), "inventory"));
}
public static void registerRender(Item item, int meta, String fileName) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, new ModelResourceLocation(fileName, "inventory"));
}*/
}

View File

@@ -0,0 +1,14 @@
package nmd.primal.forgecraft.init;
/**
* Created by kitsu on 12/3/2016.
*/
public class ModRegistries {
public static void registerFuels()
{
//if (ModConfig.FEATURE_ENABLE_FUELS)
//{
}
}

View File

@@ -0,0 +1,31 @@
package nmd.primal.forgecraft.init;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import nmd.primal.forgecraft.ModInfo;
/**
* Created by mminaie on 3/24/17.
*/
public class ModSounds {
public static SoundEvent PISTON_BELLOWS;
public static SoundEvent MUSKET_SHOT;
public static void registerSounds()
{
PISTON_BELLOWS = registerSound("piston_bellows");
MUSKET_SHOT = registerSound("musket_shot");
}
private static SoundEvent registerSound(String name)
{
ResourceLocation location = new ResourceLocation(ModInfo.MOD_ID, name);
SoundEvent sound = new SoundEvent(location);
sound.setRegistryName(location);
ForgeRegistries.SOUND_EVENTS.register(sound);
return sound;
}
}

View File

@@ -0,0 +1,26 @@
package nmd.primal.forgecraft.init;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fml.common.registry.GameRegistry;
import nmd.primal.forgecraft.tiles.*;
/**
* Created by kitsu on 12/2/2016.
*/
public class ModTiles {
public static void registerTileEntities () {
registerTileEntity(TileForge.class, "firebox");
registerTileEntity(TilePistonBellows.class, "pistonbellows");
registerTileEntity(TileBloomery.class, "bloomery");
registerTileEntity(TileBaseCrucible.class, "basecrucible");
registerTileEntity(TileAnvil.class, "anvil");
registerTileEntity(TileBreaker.class, "breaker");
registerTileEntity(TileCastingForm.class, "castingform");
registerTileEntity(TileCastingBlock.class, "castingblock");
}
private static void registerTileEntity(Class<? extends TileEntity> tile_class, String baseName) {
GameRegistry.registerTileEntity(tile_class, "tile.forgecraft." + baseName);
}
}

View File

@@ -0,0 +1,27 @@
package nmd.primal.forgecraft.items;
import net.minecraft.item.Item;
import nmd.primal.forgecraft.ModInfo;
/**
* Created by kitsu on 11/26/2016.
*/
public class BaseItem extends Item
{
public BaseItem(String registryName)
{
this.setRegistryName(registryName);
this.setUnlocalizedName(registryName);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
public String getName() {
return this.getRegistryName().toString();
}
public static boolean isHidden()
{
return false;
}
}

View File

@@ -0,0 +1,27 @@
package nmd.primal.forgecraft.items;
import net.minecraft.item.Item;
/**
* Created by mminaie on 2/19/17.
*/
public class BaseMultiItem extends BaseItem {
private Item.ToolMaterial mat;
private int ID;
public BaseMultiItem( String registryName, Item.ToolMaterial material, Integer ID) {
super(registryName);
mat = material;
this.ID = ID;
}
public Item.ToolMaterial getMaterial(Item item){
return mat;
}
public int getID() {
return ID;
}
}

View File

@@ -0,0 +1,21 @@
package nmd.primal.forgecraft.items;
import net.minecraft.item.Item;
import nmd.primal.forgecraft.ModInfo;
/**
* Created by mminaie on 3/7/17.
*/
public class ForgeHammer extends Item {
public ForgeHammer(String unlocalizedName) {
setUnlocalizedName(unlocalizedName);
this.setRegistryName(unlocalizedName);
this.setMaxDamage(1000);
//this.setHasSubtypes(true); //This just says the item has metadata
this.setMaxStackSize(1);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
}

View File

@@ -0,0 +1,30 @@
package nmd.primal.forgecraft.items;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
import nmd.primal.forgecraft.ForgeCraft;
/**
* Created by mminaie on 2/4/17.
*/
public class ItemForgingManual extends BaseItem {
public ItemForgingManual(String name) {
super(name);
}
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
{
if (world.isRemote) {
//player.openGui(ForgeCraft.instance, GuiHandler., world, 0, 0, 0);
player.openGui(ForgeCraft.instance, 0, world, (int) player.posX, (int) player.posY, (int) player.posZ);
return new ActionResult(EnumActionResult.PASS, player.getHeldItem(hand));
}
return new ActionResult(EnumActionResult.PASS, player.getHeldItem(hand));
}
}

View File

@@ -0,0 +1,12 @@
package nmd.primal.forgecraft.items;
/**
* Created by mminaie on 1/22/17.
*/
public class ItemSoftCrucible extends BaseItem {
public ItemSoftCrucible(String name) {
super(name);
}
}

View File

@@ -0,0 +1,897 @@
package nmd.primal.forgecraft.items;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.BloomeryBase;
import nmd.primal.forgecraft.blocks.Crucibles.Crucible;
import nmd.primal.forgecraft.blocks.Crucibles.CrucibleHot;
import nmd.primal.forgecraft.blocks.Forge;
import nmd.primal.forgecraft.blocks.IngotBall;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.tiles.TileBaseCrucible;
import nmd.primal.forgecraft.tiles.TileBloomery;
import nmd.primal.forgecraft.tiles.TileForge;
import java.util.List;
/**
* Created by mminaie on 1/23/17.
*/
public class ItemStoneTongs extends Item {
public ItemStoneTongs(String unlocalizedName) {
setUnlocalizedName(unlocalizedName);
this.setRegistryName(unlocalizedName);
//this.setMaxDamage(0);
//this.setHasSubtypes(true); //This just says the item has metadata
this.setMaxStackSize(1);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
//this.setDamage(item, 1000);
item.getTagCompound().setInteger("type", 0);
item.getTagCompound().setInteger("cooldown", 0);
item.getTagCompound().setTag("tags", tags);
item.getSubCompound("tags").setBoolean("hot", false);
item.getSubCompound("tags").setBoolean("emerald", false);
item.getSubCompound("tags").setInteger("diamond", 0);
item.getSubCompound("tags").setInteger("redstone", 0);
item.getSubCompound("tags").setInteger("lapis", 0);
item.getSubCompound("tags").setInteger("modifiers", 0);
}
}
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
/*
0 | Default StoneTongs
1 | Empty Crucible Hot
2 | Empty Crucible Cracked Hot
================================
3 | Hot Iron Crucible
4 | Hot Cooked Iron Crucible
5 | Hot Failed Iron Crucible
6 | Hot Iron Ingot
7 | Hot Iron Chunk
--------------------------------
8 | Hot Iron Pickaxe Head
9 | Hot Iron Axe Head
10 | Hot Iron Shovel Head
11 | Hot Iron Hoe Head
================================
12 | Hot Clean Iron Crucible
13 | Hot Cooked Clean Iron Crucible
14 | Hot Failed Clean Iron Crucible
15 | Hot Clean Iron Ball
16 | Hot Clean Iron Chunk
--------------------------------
17 | Hot Clean Iron Pickaxe Head
18 | Hot Clean Iron Axe Head
19 | Hot Clean Iron Shovel Head
20 | Hot Clean Iron Hoe Head
================================
21 | Hot Steel Crucible
22 | Hot Cooked Steel Crucible
23 | Hot Failed Steel Crucible
24 | Hot Steel Ingot
25 | Hot Steel Chunk
--------------------------------
26 | Hot Steel Pickaxe Head
27 | Hot Steel Axe Head
28 | Hot Steel Shovel Head
29 | Hot Steel Hoe Head
================================
30 | Hot Wootz Crucible
31 | Hot Cooked Wootz Crucible
32 | Hot Failed Wootz Crucible
33 | Hot Wootz Ingot
34 | Hot Wootz Chunk
--------------------------------
35 | Hot Wootz Pickaxe Head
36 | Hot Wootz Axe Head
37 | Hot Wootz Shovel Head
38 | Hot Wootz Hoe Head
================================
39 | Hot Bronze Crucible
40 | Hot Cooked Bronze Crucible
41 | Bronze Pickaxe Head
42 | Bronze Axe Head
43 | Bronze Shovel Head
44 | Bronze Hoe Head
45 | Hot Bronze Crucible Emerald
46 | Hot Cooked Bronze Crucible Emerald
47 | Hot Bronze Crucible Diamond
48 | Hot Cooked Bronze Crucible Diamond
49 | Hot Bronze Crucible Redstone
50 | Hot Cooked Bronze Crucible Redstone
51 | Hot Bronze Crucible Lapis
52 | Hot Cooked Bronze Crucible Lapis
*/
if(!world.isRemote) {
ItemStack itemstack = player.getHeldItem(hand);
//System.out.println(itemstack.getTagCompound().getInteger("type"));
//System.out.println(itemstack.getSubCompound("tags"));
/*****
Picks Up Hot Ingots from the Ground
*****/
if (world.getBlockState(pos).getBlock() instanceof BloomeryBase == false) {
if (world.getBlockState(pos).getBlock() instanceof IngotBall) {
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE) == true) {
if (world.getBlockState(pos).getBlock() == ModBlocks.ironball) {
itemstack.getTagCompound().setInteger("type", 6);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.ironchunk) {
itemstack.getTagCompound().setInteger("type", 7);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.ironcleanball) {
itemstack.getTagCompound().setInteger("type", 15);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.ironcleanchunk) {
itemstack.getTagCompound().setInteger("type", 16);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.steelball) {
itemstack.getTagCompound().setInteger("type", 24);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.steelchunk) {
itemstack.getTagCompound().setInteger("type", 25);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
/* TODO Wootz */
}
}
}
/*****
Picks Up Hot Crucibles from the Ground
*****/
if (world.getBlockState(pos).getBlock() instanceof BloomeryBase == false) {
if(world.getBlockState(pos).getBlock() instanceof CrucibleHot) {
TileBaseCrucible tileCrucible = (TileBaseCrucible) world.getTileEntity(pos);
/***************************
* Crucibles *
***************************/
if (world.getBlockState(pos).getBlock() == ModBlocks.emptycruciblehot) {
itemstack.getTagCompound().setInteger("type", 1);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.emptycruciblecrackedhot) {
itemstack.getTagCompound().setInteger("type", 2);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
/***************************
* Iron *
***************************/
if (world.getBlockState(pos).getBlock() == ModBlocks.hotironcrucible) {
itemstack.getTagCompound().setInteger("type", 3);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedironcrucible) {
itemstack.getTagCompound().setInteger("type", 4);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.failedironcruciblehot) {
itemstack.getTagCompound().setInteger("type", 5);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
/***************************
* Clean Iron *
***************************/
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcleanironcrucible) {
itemstack.getTagCompound().setInteger("type", 12);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedcleanironcrucible) {
itemstack.getTagCompound().setInteger("type", 13);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.failedcleanironcruciblehot) {
itemstack.getTagCompound().setInteger("type", 14);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
/***************************
* Steel *
***************************/
if (world.getBlockState(pos).getBlock() == ModBlocks.hotsteelcrucible) {
itemstack.getTagCompound().setInteger("type", 21);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedsteelcrucible) {
itemstack.getTagCompound().setInteger("type", 22);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.failedsteelcruciblehot) {
itemstack.getTagCompound().setInteger("type", 23);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
/* TODO Wootz */
/***************************
* Bronze *
*
45 | Hot Bronze Crucible Emerald
46 | Hot Cooked Bronze Crucible Emerald
47 | Hot Bronze Crucible Diamond
48 | Hot Cooked Bronze Crucible Diamond
49 | Hot Bronze Crucible Redstone
50 | Hot Cooked Bronze Crucible Redstone
51 | Hot Bronze Crucible Lapis
52 | Hot Cooked Bronze Crucible Lapis
***************************/
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible) {
itemstack.getTagCompound().setInteger("type", 39);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible) {
itemstack.getTagCompound().setInteger("type", 40);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_emerald) {
itemstack.getTagCompound().setInteger("type", 45);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_emerald) {
itemstack.getTagCompound().setInteger("type", 46);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_diamond) {
itemstack.getTagCompound().setInteger("type", 47);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_diamond) {
itemstack.getTagCompound().setInteger("type", 48);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_redstone) {
itemstack.getTagCompound().setInteger("type", 49);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_redstone) {
itemstack.getTagCompound().setInteger("type", 50);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_lapis) {
itemstack.getTagCompound().setInteger("type", 51);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_lapis) {
itemstack.getTagCompound().setInteger("type", 52);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
}
/*****
Places the content from the Tongs to the World
*****/
if ((world.getBlockState(pos).getBlock() instanceof Crucible) || (world.getBlockState(pos).getBlock() instanceof CrucibleHot)) {
return EnumActionResult.FAIL;
} else if (world.getBlockState(pos).getMaterial() == Material.ROCK ||
world.getBlockState(pos).getMaterial() == Material.SAND ||
world.getBlockState(pos).getMaterial() == Material.IRON ||
world.getBlockState(pos).getMaterial() == Material.ANVIL )
{
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ());
if (world.getBlockState(tempPos).getBlock() == Blocks.AIR) {
switch (itemstack.getTagCompound().getInteger("type")) {
case 0:
break;
case 1:
world.setBlockState(tempPos, ModBlocks.emptycruciblehot.getDefaultState(), 3);
TileBaseCrucible tileCrucible1 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible1.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 2:
world.setBlockState(tempPos, ModBlocks.emptycruciblecrackedhot.getDefaultState(), 3);
TileBaseCrucible tileCrucible2 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible2.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 3:
world.setBlockState(tempPos, ModBlocks.hotironcrucible.getDefaultState(), 3);
TileBaseCrucible tileCrucible3 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible3.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 4:
world.setBlockState(tempPos, ModBlocks.hotcookedironcrucible.getDefaultState(), 3);
TileBaseCrucible tileCrucible4 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible4.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 5:
world.setBlockState(tempPos, ModBlocks.failedironcruciblehot.getDefaultState(), 3);
TileBaseCrucible tileCrucible5 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible5.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 6:
world.setBlockState(tempPos, ModBlocks.ironball.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 7:
world.setBlockState(tempPos, ModBlocks.ironchunk.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 8:
return EnumActionResult.FAIL;
case 9:
return EnumActionResult.FAIL;
case 10:
return EnumActionResult.FAIL;
case 11:
return EnumActionResult.FAIL;
case 12:
world.setBlockState(tempPos, ModBlocks.hotcleanironcrucible.getDefaultState(), 3);
TileBaseCrucible tileCrucible12 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible12.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 13:
world.setBlockState(tempPos, ModBlocks.hotcookedcleanironcrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible13 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible13.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 14:
world.setBlockState(tempPos, ModBlocks.failedcleanironcruciblehot.getDefaultState(), 3);
TileBaseCrucible tileCrucible14 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible14.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 15:
world.setBlockState(tempPos, ModBlocks.ironcleanball.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 16:
world.setBlockState(tempPos, ModBlocks.ironcleanchunk.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 17:
return EnumActionResult.FAIL;
case 18:
return EnumActionResult.FAIL;
case 19:
return EnumActionResult.FAIL;
case 20:
return EnumActionResult.FAIL;
case 21:
world.setBlockState(tempPos, ModBlocks.hotsteelcrucible.getDefaultState(), 3);
TileBaseCrucible tileCrucible21 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible21.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 22:
world.setBlockState(tempPos, ModBlocks.hotcookedsteelcrucible.getDefaultState(), 3);
TileBaseCrucible tileCrucible22 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible22.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 23:
world.setBlockState(tempPos, ModBlocks.failedsteelcruciblehot.getDefaultState(), 3);
TileBaseCrucible tileCrucible23 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible23.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 24:
world.setBlockState(tempPos, ModBlocks.steelball.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 25:
world.setBlockState(tempPos, ModBlocks.steelchunk.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 39:
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible.getDefaultState(), 3);
TileBaseCrucible tileCrucible39 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible39.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 40:
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible.getDefaultState(), 3);
TileBaseCrucible tileCrucible40 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible40.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
/***************************
* Bronze *
*
45 | Hot Bronze Crucible Emerald
46 | Hot Cooked Bronze Crucible Emerald
47 | Hot Bronze Crucible Diamond
48 | Hot Cooked Bronze Crucible Diamond
49 | Hot Bronze Crucible Redstone
50 | Hot Cooked Bronze Crucible Redstone
51 | Hot Bronze Crucible Lapis
52 | Hot Cooked Bronze Crucible Lapis
***************************/
case 45:
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_emerald.getDefaultState(), 3);
TileBaseCrucible tileCrucible45 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible45.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 46:
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_emerald.getDefaultState(), 3);
TileBaseCrucible tileCrucible46 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible46.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 47:
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_diamond.getDefaultState(), 3);
TileBaseCrucible tileCrucible47 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible47.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 48:
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_diamond.getDefaultState(), 3);
TileBaseCrucible tileCrucible48 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible48.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 49:
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_redstone.getDefaultState(), 3);
TileBaseCrucible tileCrucible49 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible49.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 50:
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_redstone.getDefaultState(), 3);
TileBaseCrucible tileCrucible50 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible50.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 51:
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_lapis.getDefaultState(), 3);
TileBaseCrucible tileCrucible51 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible51.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 52:
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_lapis.getDefaultState(), 3);
TileBaseCrucible tileCrucible52 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible52.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
}
}
}
}
/*****
Pulls the crucible from the Bloomery
*****/
if (world.getBlockState(pos).getBlock() instanceof BloomeryBase) {
if (itemstack.getTagCompound().getInteger("type") == 0) {
TileBloomery tile = (TileBloomery) world.getTileEntity(pos);
if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.emptycruciblehot))) {
itemstack.getTagCompound().setInteger("type", 1);
itemstack.getTagCompound().setInteger("cooldown", 0);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.emptycruciblecrackedhot))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 2);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotironcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 3);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedironcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 4);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.failedironcruciblehot))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 5);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcleanironcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 12);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedcleanironcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 13);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.failedcleanironcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 14);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotsteelcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 21);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedsteelcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 22);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.failedsteelcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 23);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 39);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 40);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
/***************************
* Bronze *
*
45 | Hot Bronze Crucible Emerald
46 | Hot Cooked Bronze Crucible Emerald
47 | Hot Bronze Crucible Diamond
48 | Hot Cooked Bronze Crucible Diamond
49 | Hot Bronze Crucible Redstone
50 | Hot Cooked Bronze Crucible Redstone
51 | Hot Bronze Crucible Lapis
52 | Hot Cooked Bronze Crucible Lapis
***************************/
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_emerald))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 45);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_emerald))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 46);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_diamond))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 47);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_diamond))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 48);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_redstone))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 49);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_redstone))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 50);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_lapis))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 51);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_lapis))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 52);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
}
/*****
Pulls the Tool Parts from the Forge
*****/
if(itemstack.getTagCompound().getInteger("type") == 0){
if (world.getBlockState(pos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(pos);
for (int i = 2; i < tile.getSlotListSize(); i++) {
if (tile.getSlotStack(i).getItem().equals(ModItems.ironchunkhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 7);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironingotballhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 6);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.pickaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 8);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 9);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironshovelhead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 10);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironhoehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 11);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironcleanchunkhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 16);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironcleaningotballhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 15);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironpickaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 17);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 18);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironshovelhead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 19);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironhoehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 20);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelchunkhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 25);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelingotballhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 24);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelpickaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 26);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 27);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelshovelhead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 28);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelhoehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 29);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
}
}
}
else return EnumActionResult.FAIL;
//System.out.println(itemstack.getTagCompound().getInteger("type"));
}
//System.out.println(player.getHeldItem(hand).getTagCompound().getInteger("type"));
return EnumActionResult.SUCCESS;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
//tooltip.add(ChatFormatting.BLUE + "NBT: " + item.getSubCompound("tags"));
//tooltip.add(ChatFormatting.RED + "NBT: " + item.getTagCompound().getInteger("type"));
}
}

View File

@@ -0,0 +1,12 @@
package nmd.primal.forgecraft.items;
/**
* Created by kitsu on 11/26/2016.
*/
public class ItemTest extends BaseItem {
public ItemTest(String string) {
super(string);
}
}

View File

@@ -0,0 +1,56 @@
package nmd.primal.forgecraft.items.blocks;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.enumhandler.EnumHandler;
import java.util.List;
//import static nmd.primal.forgecraft.enumhandler.EnumHandler.IngotTypes.*;
/**
* Created by mminaie on 2/12/17.
*/
public class ItemBlockIngotBall extends ItemBlock {
public ItemBlockIngotBall(Block block){
super(block);
this.setMaxDamage(0);
this.setHasSubtypes(true);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
//this.setRegistryName(name);
}
public int getMetadata(int damage)
{
return damage;
}
public String getUnlocalizedNameInefficiently(ItemStack stack) {
EnumHandler.IngotTypes v = EnumHandler.IngotTypes.values()[stack.getItemDamage()];
//EnumOreType z = EnumOreType.values()[stack.getItemDamage()];
switch(v) {
case IRONCOOL:
case IRONHOT:
return "item.forgecraft:"+v.name;
default:
return "item.forgecraft:unknown";
}
}
@SideOnly(Side.CLIENT)
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
subItems.add(new ItemStack(itemIn, 1, EnumHandler.IngotTypes.IRONCOOL.meta));
subItems.add(new ItemStack(itemIn, 1, EnumHandler.IngotTypes.IRONHOT.meta));
}
}

View File

@@ -0,0 +1,13 @@
package nmd.primal.forgecraft.items.casting;
import nmd.primal.forgecraft.items.BaseItem;
/**
* Created by mminaie on 6/24/17.
*/
public class CastingPart extends BaseItem {
public CastingPart(String registryName) {
super(registryName);
}
}

View File

@@ -0,0 +1,154 @@
package nmd.primal.forgecraft.items.parts;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
/**
* Created by mminaie on 3/9/17.
*/
public class BronzeToolPart extends Item implements ToolNBT{
private int ID;
public BronzeToolPart(String name, ToolMaterial material, Integer ID) {
this.setMaxDamage(material.getMaxUses());
this.setUnlocalizedName(name);
this.setRegistryName(name);
//this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.ID = ID;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter()
{
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (item.hasTagCompound()) {
if (getModifiers(item) != 0) {
if (getEmerald(item)) {
return 0.1F;
}
if (getDiamondLevel(item) == 1) {
return 0.2F;
}
if ( getRedstoneLevel(item) == 1) {
return 0.3F;
}
if (getLapisLevel(item) == 1) {
return 0.4F;
}
}
if (getModifiers(item) == 0) {
return 0.0F;
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
public int getID() {
return ID;
}
@Override
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
if(player.getEntityWorld().isRemote) {
if(item.hasTagCompound()) {
tooltip.add(ChatFormatting.GRAY + "Upgrades");
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
}
if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item));
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item));
}
}
}
}
}

View File

@@ -0,0 +1,299 @@
package nmd.primal.forgecraft.items.parts;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
/**
* Created by mminaie on 3/9/17.
*/
public class ToolPart extends Item implements ToolNBT{
private int ID;
public ToolPart(String name, Item.ToolMaterial material, Integer ID) {
this.setMaxDamage(material.getMaxUses());
this.setUnlocalizedName(name);
this.setRegistryName(name);
//this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.ID = ID;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter()
{
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (item.hasTagCompound()) {
if (getHot(item) == false) {
if (getModifiers(item) != 0) {
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.1F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.11F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.12F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.111F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.102F;
}
// ============
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.01F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.02F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 3) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.03F;
}
//=======
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.001F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.002F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 3) &&
(getLapisLevel(item) == 0)) {
return 0.003F;
}
//=========
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 1)) {
return 0.0001F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2)) {
return 0.0002F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 3)) {
return 0.0003F;
}
//=======
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 1)) {
return 0.0111F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.021F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.012F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 2)) {
return 0.0012F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 1)) {
return 0.0021F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2) ) {
return 0.0102F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 1) ) {
return 0.0011F;
}
}
}
if (getHot(item) == true) {
return 1.0F;
}
if (getHot(item) == false) {
if (getModifiers(item) == 0) {
return 0.0F;
}
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
public int getID() {
return ID;
}
@Override
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
if(player.getEntityWorld().isRemote) {
if(item.hasTagCompound()) {
tooltip.add(ChatFormatting.GRAY + "Upgrades");
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
}
if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item));
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item));
}
}
}
}
}

View File

@@ -0,0 +1,235 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 6/25/17.
*/
public class BronzeAxe extends ItemAxe implements ToolNBT {
public BronzeAxe(String name, Item.ToolMaterial material) {
super(material, 5, -2f);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (item.hasTagCompound()) {
if (getModifiers(item) != 0) {
if (getEmerald(item)) {
return 0.1F;
}
if (getDiamondLevel(item) == 1) {
return 0.2F;
}
if ( getRedstoneLevel(item) == 1) {
return 0.3F;
}
if (getLapisLevel(item) == 1) {
return 0.4F;
}
}
if (getModifiers(item) == 0) {
return 0.0F;
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.bronzeaxehead, 1));
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
if(!item.isEmpty()) {
if (player.getEntityWorld().isRemote) {
if (item.hasTagCompound()) {
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - getModifiers(item)) );
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
}
if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + "1" );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + "5" );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}
}
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
//System.out.println(world.getBlockState(pos).getBlock());
if(itemstack.getItem() instanceof CustomAxe){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
/*if( getDiamondLevel(itemstack) > 0 ){
itemstack.getItem().setHarvestLevel("pickaxe", 3);
}*/
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5);
}
}
}
return false;
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
}
return true;
}
@Override
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
Material material = state.getMaterial();
//return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
if(material != Material.WOOD && material != Material.PLANTS && material != Material.VINE){
return super.getStrVsBlock(stack, state);
} else {
return this.efficiencyOnProperMaterial + 1;
}
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
}

View File

@@ -0,0 +1,223 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 3/21/17.
*/
public class BronzeHoe extends ItemHoe implements ToolNBT {
public BronzeHoe(String name, ToolMaterial material) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (item.hasTagCompound()) {
if (getModifiers(item) != 0) {
if (getEmerald(item)) {
return 0.1F;
}
if (getDiamondLevel(item) == 1) {
return 0.2F;
}
if ( getRedstoneLevel(item) == 1) {
return 0.3F;
}
if (getLapisLevel(item) == 1) {
return 0.4F;
}
}
if (getModifiers(item) == 0) {
return 0.0F;
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.bronzehoehead, 1));
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
if(player.getEntityWorld().isRemote) {
//tooltip.add(ChatFormatting.GRAY + "Damage: " + item.getItemDamage() );
if(item.hasTagCompound()) {
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - getModifiers(item)) );
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
}
if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + 1 );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + 5 );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
if(itemstack.getItem() instanceof BronzeHoe){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
/*if( getDiamondLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
itemstack.getItem().setHarvestLevel("pickaxe", 3);
}*/
/*if( getRedstoneLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
//System.out.println(itemstack.getEnchantmentTagList());
}*/
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5);
}
}
}
return false;
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
}
return true;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
}

View File

@@ -0,0 +1,236 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 3/14/17.
*/
public class BronzePickaxe extends ItemPickaxe implements ToolNBT{
public BronzePickaxe(String name, ToolMaterial material) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
//this.toolClass = "pickaxe";
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (item.hasTagCompound()) {
if (getModifiers(item) != 0) {
if (getEmerald(item)) {
return 0.1F;
}
if (getDiamondLevel(item) == 1) {
return 0.2F;
}
if ( getRedstoneLevel(item) == 1) {
return 0.3F;
}
if (getLapisLevel(item) == 1) {
return 0.4F;
}
}
if (getModifiers(item) == 0) {
return 0.0F;
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.bronzepickaxehead, 1));
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
if(player.getEntityWorld().isRemote) {
//tooltip.add(ChatFormatting.GRAY + "Damage: " + item.getItemDamage() );
if(item.hasTagCompound()) {
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - getModifiers(item)) );
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
}
if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + 1 );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + 5 );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
//System.out.println(world.getBlockState(pos).getBlock());
if(itemstack.getItem() instanceof BronzePickaxe){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
/*if( getDiamondLevel(itemstack) > 0 ){
//itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
itemstack.getItem().setHarvestLevel("pickaxe", 3);
}*/
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5);
}
}
}
return false;
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
}
return true;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
@Override
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
Material material = state.getMaterial();
//return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
if(material != Material.IRON && material != Material.ANVIL && material != Material.ROCK){
return super.getStrVsBlock(stack, state);
} else {
return this.efficiencyOnProperMaterial + 1;
}
}
}

View File

@@ -0,0 +1,232 @@
package nmd.primal.forgecraft.items.tools;
import com.google.common.collect.Sets;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 3/21/17.
*/
public class BronzeShovel extends ItemSpade implements ToolNBT {
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH});
public BronzeShovel(String name, ToolMaterial material) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (item.hasTagCompound()) {
if (getModifiers(item) != 0) {
if (getEmerald(item)) {
return 0.1F;
}
if (getDiamondLevel(item) == 1) {
return 0.2F;
}
if ( getRedstoneLevel(item) == 1) {
return 0.3F;
}
if (getLapisLevel(item) == 1) {
return 0.4F;
}
}
if (getModifiers(item) == 0) {
return 0.0F;
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.bronzeshovelhead, 1));
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
if(player.getEntityWorld().isRemote) {
//tooltip.add(ChatFormatting.GRAY + "Damage: " + item.getItemDamage() );
if(item.hasTagCompound()) {
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - getModifiers(item)) );
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
}
if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + 1 );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + 5 );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
if(itemstack.getItem() instanceof BronzeShovel){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5);
}
}
}
return false;
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
}
return true;
}
@Override
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
for (String type : getToolClasses(stack))
{
if (state.getBlock().isToolEffective(type, state))
return efficiencyOnProperMaterial;
}
return this.efficiencyOnProperMaterial + 1;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
}

View File

@@ -0,0 +1,379 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 3/20/17.
*/
public class CustomAxe extends ItemAxe implements ToolNBT {
public CustomAxe(String name, Item.ToolMaterial material) {
super(material, 6, -3.1f);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
if (item.hasTagCompound()) {
if (getHot(item) != true) {
if (getModifiers(item) != 0) {
if ((getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.1F;
}
if ((getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.11F;
}
if ((getEmerald(item) == true) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.12F;
}
if ((getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.111F;
}
if ((getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.102F;
}
// ============
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.01F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.02F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 3) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.03F;
}
//=======
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.001F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.002F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 3) &&
(getLapisLevel(item) == 0)) {
return 0.003F;
}
//=========
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 1)) {
return 0.0001F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2)) {
return 0.0002F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 3)) {
return 0.0003F;
}
//=======
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 1)) {
return 0.0111F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.021F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.012F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 2)) {
return 0.0012F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 1)) {
return 0.0021F;
}
if ((getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2)) {
return 0.0102F;
}
}
}
if (getHot(item) == true) {
return 1.0F;
}
if (getHot(item) == false) {
if (getModifiers(item) == 0) {
return 0.0F;
}
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) < 5 ){
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
if(!item.isEmpty()) {
if (player.getEntityWorld().isRemote) {
if (item.hasTagCompound()) {
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (3 - getModifiers(item)) );
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
}
if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item) );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}
}
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
//System.out.println(world.getBlockState(pos).getBlock());
if(itemstack.getItem() instanceof CustomAxe){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
if( getDiamondLevel(itemstack) > 0 ){
//itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
itemstack.getItem().setHarvestLevel("pickaxe", 3);
}
/*if( getRedstoneLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
//System.out.println(itemstack.getEnchantmentTagList());
}*/
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack));
}
}
}
return false;
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
}
return true;
}
@Override
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
Material material = state.getMaterial();
//return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
if(material != Material.WOOD && material != Material.PLANTS && material != Material.VINE){
return super.getStrVsBlock(stack, state);
} else {
return this.efficiencyOnProperMaterial * ( (this.getRedstoneLevel(stack) * 2 ) + 1);
}
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
}

View File

@@ -0,0 +1,359 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 3/21/17.
*/
public class CustomHoe extends ItemHoe implements ToolNBT {
public CustomHoe(String name, Item.ToolMaterial material) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
if (item.hasTagCompound()) {
if (getHot(item) == false) {
if (getModifiers(item) != 0) {
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.1F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.11F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.12F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.111F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.102F;
}
// ============
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.01F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.02F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 3) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.03F;
}
//=======
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.001F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.002F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 3) &&
(getLapisLevel(item) == 0)) {
return 0.003F;
}
//=========
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 1)) {
return 0.0001F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2)) {
return 0.0002F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 3)) {
return 0.0003F;
}
//=======
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 1)) {
return 0.0111F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.021F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.012F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 2)) {
return 0.0012F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 1)) {
return 0.0021F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2) ) {
return 0.0102F;
}
}
}
if (getHot(item) == true) {
return 1.0F;
}
if (getHot(item) == false) {
if (getModifiers(item) == 0) {
return 0.0F;
}
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
if(player.getEntityWorld().isRemote) {
if(item.hasTagCompound()) {
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (3 - getModifiers(item)) );
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
}
if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item) );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
if(itemstack.getItem() instanceof CustomHoe){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
/*if( getDiamondLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
itemstack.getItem().setHarvestLevel("pickaxe", 3);
}*/
/*if( getRedstoneLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
//System.out.println(itemstack.getEnchantmentTagList());
}*/
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack));
}
}
}
return false;
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
}
return true;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
}

View File

@@ -0,0 +1,377 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 3/14/17.
*/
public class CustomPickaxe extends ItemPickaxe implements ToolNBT{
public CustomPickaxe(String name, Item.ToolMaterial material) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
//this.toolClass = "pickaxe";
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
if (item.hasTagCompound()) {
if (getHot(item) == false) {
if (getModifiers(item) != 0) {
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.1F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.11F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.12F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.111F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.102F;
}
// ============
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.01F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.02F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 3) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.03F;
}
//=======
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.001F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.002F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 3) &&
(getLapisLevel(item) == 0)) {
return 0.003F;
}
//=========
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 1)) {
return 0.0001F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2)) {
return 0.0002F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 3)) {
return 0.0003F;
}
//=======
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 1)) {
return 0.0111F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.021F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.012F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 2)) {
return 0.0012F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 1)) {
return 0.0021F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2) ) {
return 0.0102F;
}
}
}
if (getHot(item) == true) {
return 1.0F;
}
if (getHot(item) == false) {
if (getModifiers(item) == 0) {
return 0.0F;
}
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
}
/*if(){
}*/
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
if(player.getEntityWorld().isRemote) {
//tooltip.add(ChatFormatting.GRAY + "Damage: " + item.getItemDamage() );
if(item.hasTagCompound()) {
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (3 - getModifiers(item)) );
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
}
if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item) );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
//System.out.println(world.getBlockState(pos).getBlock());
if(itemstack.getItem() instanceof CustomPickaxe){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
if( getDiamondLevel(itemstack) > 0 ){
//itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
itemstack.getItem().setHarvestLevel("pickaxe", 3);
}
/*if( getRedstoneLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
//System.out.println(itemstack.getEnchantmentTagList());
}*/
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack));
}
}
}
return false;
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
}
return true;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
@Override
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
Material material = state.getMaterial();
//return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
if(material != Material.IRON && material != Material.ANVIL && material != Material.ROCK){
return super.getStrVsBlock(stack, state);
} else {
return this.efficiencyOnProperMaterial * ( (this.getRedstoneLevel(stack) * 2 ) + 1);
}
}
}

View File

@@ -0,0 +1,375 @@
package nmd.primal.forgecraft.items.tools;
import com.google.common.collect.Sets;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 3/21/17.
*/
public class CustomShovel extends ItemSpade implements ToolNBT {
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH});
public CustomShovel(String name, Item.ToolMaterial material) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
if (item.hasTagCompound()) {
if (getHot(item) == false) {
if (getModifiers(item) != 0) {
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.1F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.11F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.12F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.111F;
}
if ( (getEmerald(item) == true) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.102F;
}
// ============
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.01F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.02F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 3) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 0)) {
return 0.03F;
}
//=======
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.001F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.002F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 3) &&
(getLapisLevel(item) == 0)) {
return 0.003F;
}
//=========
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 1)) {
return 0.0001F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2)) {
return 0.0002F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 3)) {
return 0.0003F;
}
//=======
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 1)) {
return 0.0111F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 2) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 0)) {
return 0.021F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 0)) {
return 0.012F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 1) &&
(getLapisLevel(item) == 2)) {
return 0.0012F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 0) &&
(getRedstoneLevel(item) == 2) &&
(getLapisLevel(item) == 1)) {
return 0.0021F;
}
if ( (getEmerald(item) == false) &&
(getDiamondLevel(item) == 1) &&
(getRedstoneLevel(item) == 0) &&
(getLapisLevel(item) == 2) ) {
return 0.0102F;
}
}
}
if (getHot(item) == true) {
return 1.0F;
}
if (getHot(item) == false) {
if (getModifiers(item) == 0) {
return 0.0F;
}
}
}
return 0.0F;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
/*setHot(item, false);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);*/
}
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
setHot(item, false);
setEmerald(item, false);
setDiamondLevel(item, 0);
setRedstoneLevel(item, 0);
setLapisLevel(item, 0);
setModifiers(item, 0);
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
if(player.getEntityWorld().isRemote) {
if(item.hasTagCompound()) {
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (3 - getModifiers(item)) );
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
}
if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item) );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
if(itemstack.getItem() instanceof CustomShovel){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
if( getDiamondLevel(itemstack) > 0 ){
//itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
itemstack.getItem().setHarvestLevel("shovel", 3);
}
/*if( getRedstoneLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
//System.out.println(itemstack.getEnchantmentTagList());
}*/
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack));
}
}
}
return false;
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
}
return true;
}
@Override
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
for (String type : getToolClasses(stack))
{
if (state.getBlock().isToolEffective(type, state))
return efficiencyOnProperMaterial;
}
return this.EFFECTIVE_ON.contains(state.getBlock()) ? (this.efficiencyOnProperMaterial * ( (this.getRedstoneLevel(stack) * 2 ) + 1)) : 1.0F;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
}

View File

@@ -0,0 +1,39 @@
package nmd.primal.forgecraft.items.weapons;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemShield;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
import javax.annotation.Nullable;
/**
* Created by mminaie on 3/30/17.
*/
public class CustomShield extends ItemShield {
public CustomShield(String name, Item.ToolMaterial material)
{
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.setMaxDamage(material.getMaxUses());
this.addPropertyOverride(new ResourceLocation("blocking"), new IItemPropertyGetter() {
@SideOnly(Side.CLIENT)
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
return entityIn != null && entityIn.isHandActive() && entityIn.getActiveItemStack() == stack ? 1.0F : 0.0F;
}
});
}
}

View File

@@ -0,0 +1,66 @@
package nmd.primal.forgecraft.items.weapons;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
/**
* Created by mminaie on 3/23/17.
*/
public class CustomSword extends ItemSword {
private double attack, speed;
public CustomSword(String name, Item.ToolMaterial material, double attackDamage, double attackSpeed) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.attack = attackDamage;
this.speed = attackSpeed;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
@Override
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot)
{
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
if (equipmentSlot == EntityEquipmentSlot.MAINHAND)
{
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", this.attack, 0));
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.speed, 0));
}
return multimap;
}
}

View File

@@ -0,0 +1,121 @@
package nmd.primal.forgecraft.items.weapons;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.common.entities.projectiles.EntityMuckBall;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModSounds;
import nmd.primal.forgecraft.items.BaseItem;
import javax.annotation.Nullable;
/**
* Created by Lyle on 4/2/2017.
*/
public class Musket extends BaseItem{
public Musket(String name) {
super(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
//this.description = ".72 Calibre"
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
if(item.hasTagCompound()){
if ( item.getTagCompound().getBoolean("use") == true) {
return 0.1f;
} else return 0.0f;
} else return 0.0f;
}
});
}
// Temporary onItemRightClick method
@Override
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entityLiving, int timeLeft)
{
System.out.println("Stopped Using");
EntityPlayer player = (EntityPlayer) entityLiving;
System.out.println(player.getItemInUseCount());
//if(player.getItemInUseCount() > 5) {
world.playSound( null, player.posX, player.posY, player.posZ, ModSounds.MUSKET_SHOT, SoundCategory.BLOCKS, 0.5F, 0.3F / (itemRand.nextFloat() * 0.4F + 0.8F));
EntityMuckBall entity = new EntityMuckBall(world, player);
entity.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0.0F, 7.0F, 0.5F);
world.spawnEntity(entity);
if (!stack.hasTagCompound()) {
stack.setTagCompound(new NBTTagCompound());
}
stack.getTagCompound().setBoolean("use", false);
//}
}
/*
public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase entityLiving)
{
if (entityLiving instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) entityLiving;
world.playSound( null, player.posX, player.posY, player.posZ, ModSounds.MUSKET_SHOT, SoundCategory.BLOCKS, 0.5F, 0.3F / (itemRand.nextFloat() * 0.4F + 0.8F));
EntityMuckBall entity = new EntityMuckBall(world, player);
entity.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0.0F, 7.0F, 0.5F);
world.spawnEntity(entity);
}
return stack;
}
*/
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
{
ItemStack itemstack = playerIn.getHeldItem(handIn);
boolean flag = true;
if (!itemstack.hasTagCompound()) {
itemstack.setTagCompound(new NBTTagCompound());
}
itemstack.getTagCompound().setBoolean("use", true);
ActionResult<ItemStack> ret = net.minecraftforge.event.ForgeEventFactory.onArrowNock(itemstack, worldIn, playerIn, handIn, flag);
if (ret != null) {
return ret;
}
if (!playerIn.capabilities.isCreativeMode && !flag)
{
return flag ? new ActionResult(EnumActionResult.PASS, itemstack) : new ActionResult(EnumActionResult.FAIL, itemstack);
}
else
{
playerIn.setActiveHand(handIn);
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
}
public int getMaxItemUseDuration(ItemStack stack)
{
return 7200;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack stack)
{
return EnumAction.BOW;
}
}

View File

@@ -0,0 +1,76 @@
package nmd.primal.forgecraft.items.weapons;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
/**
* Created by mminaie on 6/25/17.
*/
public class SlayerSword extends ItemSword {
private double attack, speed;
public SlayerSword(String name, Item.ToolMaterial material, double attackDamage, double attackSpeed) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.attack = attackDamage;
this.speed = attackSpeed;
}
@Override
public void onUpdate(ItemStack item, World world, Entity playerin, int itemSlot, boolean isSelected) {
if(isSelected){
playerin.setSprinting(false);
}
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
@Override
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot)
{
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
if (equipmentSlot == EntityEquipmentSlot.MAINHAND)
{
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", this.attack, 0));
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.speed, 0));
}
return multimap;
}
}

View File

@@ -0,0 +1,47 @@
package nmd.primal.forgecraft.proxy;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.renders.blocks.*;
import nmd.primal.forgecraft.tiles.*;
/**
* Created by kitsu on 11/26/2016.
*/
public class ClientProxy implements CommonProxy {
@Override
public void preInit(){
ModItems.registerCustomRenders();
}
@Override
public void init() {
//OBJLoader.INSTANCE.addDomain(ModInfo.MOD_ID);
//Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.stonetongs, 0, new ModelResourceLocation("stonetongs", "inventory"));
ModItems.registerRenders();
ModBlocks.registerRenders();
//this.registerModelBakeryStuff();
this.registerTileRendering();
}
//@Override
public void registerTileRendering()
{
ClientRegistry.bindTileEntitySpecialRenderer(TileForge.class, new TileForgeRender());
ClientRegistry.bindTileEntitySpecialRenderer(TilePistonBellows.class, new TilePistonBellowsRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileBloomery.class, new TileBloomeryRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileAnvil.class, new TileAnvilRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileBreaker.class, new TileBreakerRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileCastingForm.class, new TileCastingformRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileCastingBlock.class, new TileCastingBlockRender());
}
@Override
public void registerModelBakeryVariants(){
//ModelBakery.registerItemVariants(ModItems.stonetongs, new ResourceLocation(ModInfo.MOD_ID, "stonetongs_default"),
// new ResourceLocation(ModInfo.MOD_ID, "stonetongs_emptyhot"));
}
}

View File

@@ -0,0 +1,14 @@
package nmd.primal.forgecraft.proxy;
/**
* Created by kitsu on 11/26/2016.
*/
public interface CommonProxy {
public void preInit();
public void init();
public void registerModelBakeryVariants();
}

View File

@@ -0,0 +1,21 @@
package nmd.primal.forgecraft.proxy;
/**
* Created by kitsu on 11/26/2016.
*/
public class ServerProxy implements CommonProxy {
@Override
public void preInit() {
}
public void init(){
}
public void registerModelBakeryVariants(){
}
}

View File

@@ -0,0 +1,533 @@
package nmd.primal.forgecraft.renders.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import nmd.primal.core.api.PrimalItems;
import nmd.primal.forgecraft.blocks.Anvil.AnvilBase;
import nmd.primal.forgecraft.blocks.Anvil.AnvilStone;
import nmd.primal.forgecraft.blocks.IngotBall;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.BaseMultiItem;
import nmd.primal.forgecraft.tiles.TileAnvil;
import org.lwjgl.opengl.GL11;
/**
* Created by mminaie on 3/5/17.
*/
public class TileAnvilRender extends TileEntitySpecialRenderer<TileAnvil>
{
private RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
@Override
public void renderTileEntityAt(TileAnvil tile, double x, double y, double z, float partialTicks, int destroyStage) {
BlockPos pos = tile.getPos();
IBlockState state = this.getWorld().getBlockState(pos);
if (state.getBlock() instanceof AnvilBase) {
GL11.glPushMatrix();
GL11.glTranslated(x, y + 1.5D, z);
//GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
float prevLGTX = OpenGlHelper.lastBrightnessX;
float prevLGTY = OpenGlHelper.lastBrightnessY;
int bright = tile.getWorld().getCombinedLight(pos.up(), 0);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, bright % 65536, bright / 65536);
/*
NORTH
SLOT | X | Y
0 | 2/16 | 2/16
1 | 5/16 | 2/16
2 | 8/16 | 2/16
3 | 11/16 | 2/16
4 | 14/16 | 2/16
--------------------
5 | 2/16 | 5/16
6 | 5/16 | 5/16
7 | 8/16 | 5/16
8 | 11/16 | 5/16
9 | 14/16 | 5/16
--------------------
10 | 2/16 | 8/16
11 | 5/16 | 8/16
12 | 8/16 | 8/16
13 | 11/16 | 8/16
14 | 14/16 | 8/16
--------------------
15 | 2/16 | 11/16
16 | 5/16 | 11/16
17 | 8/16 | 11/16
18 | 11/16 | 11/16
19 | 14/16 | 11/16
--------------------
20 | 2/16 | 14/16
21 | 5/16 | 14/16
22 | 8/16 | 14/16
23 | 11/16 | 14/16
24 | 14/16 | 14/16
*/
if (state.getValue(AnvilBase.FACING) == EnumFacing.NORTH) {
int counter = 0;
for (int i = 0; i < 5; i++) {
for (int a = 0; a < 5; a++) {
if (!tile.getSlotStack(counter).isEmpty()) {
Item item = tile.getSlotStack(counter).getItem();
if (item.equals(Items.REDSTONE) ||
(item.equals(Items.DYE) && tile.getSlotStack(counter).getItemDamage() == EnumDyeColor.BLUE.getDyeDamage()) ||
item.equals(PrimalItems.EMERALD_KNAPP) ||
item.equals(PrimalItems.DIAMOND_KNAPP) ||
item.equals(Items.DIAMOND) ||
item.equals(Items.EMERALD)
) {
GL11.glPushMatrix();
GL11.glTranslated(tile.getNormalX(a), -0.499D, tile.getNormalZ(i));
GL11.glRotated(-90.0F, 1.0F, -0.0F, 0.0F);
GL11.glScaled(0.25D, 0.25D, 0.25D);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item.equals(ModItems.pickaxehead) ||
item.equals(ModItems.cleanironpickaxehead) ||
item.equals(ModItems.steelpickaxehead) ||
item.equals(ModItems.wootzpickaxehead)
) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.465D, tile.getNormalZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item.equals(ModItems.ironaxehead) ||
item.equals(ModItems.cleanironaxehead) ||
item.equals(ModItems.steelaxehead) ||
item.equals(ModItems.wootzaxehead)
) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.51D, tile.getNormalZ(i));
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotated(180.0F, 0.0F, 0.0F, 1.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item.equals(ModItems.ironshovelhead) ||
item.equals(ModItems.cleanironshovelhead) ||
item.equals(ModItems.steelshovelhead) ||
item.equals(ModItems.steelshovelhead)
) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.450D, tile.getNormalZ(i));
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotated(90.0F, 0.0F, 0.0F, 1.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item.equals(ModItems.ironhoehead) ||
item.equals(ModItems.cleanironhoehead) ||
item.equals(ModItems.steelhoehead) ||
item.equals(ModItems.steelhoehead)
) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getNormalZ(i));
GL11.glRotated(180.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (Block.getBlockFromItem(item) instanceof IngotBall) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.44D, tile.getNormalZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item instanceof BaseMultiItem) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.50D, tile.getNormalZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
}
counter++;
}
}
}
if (state.getValue(AnvilStone.FACING) == EnumFacing.SOUTH) {
int counter = 0;
for (int i = 0; i < 5; i++) {
for (int a = 0; a < 5; a++) {
if (!tile.getSlotStack(counter).isEmpty()) {
Item item = tile.getSlotStack(counter).getItem();
if (item.equals(Items.REDSTONE) ||
(item.equals(Items.DYE) && tile.getSlotStack(counter).getItemDamage() == EnumDyeColor.BLUE.getDyeDamage()) ||
item.equals(PrimalItems.EMERALD_KNAPP) ||
item.equals(PrimalItems.DIAMOND_KNAPP) ||
item.equals(Items.DIAMOND) ||
item.equals(Items.EMERALD)
) {
GL11.glPushMatrix();
GL11.glTranslated(tile.getReverseX(a), -0.49D, tile.getReverseZ(i));
GL11.glRotated(-90.0F, 1.0F, -0.0F, 0.0F);
GL11.glScaled(0.25D, 0.25D, 0.25D);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item.equals(ModItems.pickaxehead) ||
item.equals(ModItems.cleanironpickaxehead) ||
item.equals(ModItems.steelpickaxehead) ||
item.equals(ModItems.wootzpickaxehead)
) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getReverseX(a), -0.435D, tile.getReverseZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item.equals(ModItems.ironaxehead) ||
item.equals(ModItems.cleanironaxehead) ||
item.equals(ModItems.steelaxehead) ||
item.equals(ModItems.wootzaxehead)
) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getReverseX(a), -0.435D, tile.getReverseZ(i));
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item.equals(ModItems.ironshovelhead) ||
item.equals(ModItems.cleanironshovelhead) ||
item.equals(ModItems.steelshovelhead) ||
item.equals(ModItems.steelshovelhead)
) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getReverseX(a), -0.435D, tile.getReverseZ(i));
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item.equals(ModItems.ironhoehead) ||
item.equals(ModItems.cleanironhoehead) ||
item.equals(ModItems.steelhoehead) ||
item.equals(ModItems.wootzhoehead)
) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getReverseX(a), -0.435D, tile.getReverseZ(i));
GL11.glRotated(180.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (Block.getBlockFromItem(item) instanceof IngotBall) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getReverseX(a), -0.44D, tile.getReverseZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item instanceof BaseMultiItem) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getReverseX(a), -0.44D, tile.getReverseZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
}
counter++;
}
}
}
if (state.getValue(AnvilStone.FACING) == EnumFacing.WEST) {
int counter = 0;
for (int a = 0; a < 5; a++) {
for (int i = 0; i < 5; i++) {
if (!tile.getSlotStack(counter).isEmpty()) {
Item item = tile.getSlotStack(counter).getItem();
if (item.equals(Items.REDSTONE) ||
(item.equals(Items.DYE) && tile.getSlotStack(counter).getItemDamage() == EnumDyeColor.BLUE.getDyeDamage()) ||
item.equals(PrimalItems.EMERALD_KNAPP) ||
item.equals(PrimalItems.DIAMOND_KNAPP) ||
item.equals(Items.DIAMOND) ||
item.equals(Items.EMERALD)
) {
GL11.glPushMatrix();
GL11.glTranslated(tile.getNormalX(a), -0.49D, tile.getReverseZ(i));
GL11.glRotated(-90.0F, 1.0F, -0.0F, 0.0F);
GL11.glScaled(0.25D, 0.25D, 0.25D);
GL11.glRotated(-90.0F, 0.0F, 0.0F, 1.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item.equals(ModItems.pickaxehead) ||
item.equals(ModItems.cleanironpickaxehead) ||
item.equals(ModItems.steelpickaxehead) ||
item.equals(ModItems.wootzpickaxehead)
) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getReverseZ(i));
GL11.glRotated(-90.0F, 0.0F, 1.0F, 0.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item.equals(ModItems.ironaxehead) ||
item.equals(ModItems.cleanironaxehead) ||
item.equals(ModItems.steelaxehead) ||
item.equals(ModItems.wootzaxehead)
) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getReverseZ(i));
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item.equals(ModItems.ironshovelhead) ||
item.equals(ModItems.cleanironshovelhead) ||
item.equals(ModItems.steelshovelhead) ||
item.equals(ModItems.steelshovelhead)
) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getReverseZ(i));
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item.equals(ModItems.ironhoehead)) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getReverseZ(i));
GL11.glRotated(180.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (Block.getBlockFromItem(item) instanceof IngotBall) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.44D, tile.getReverseZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item instanceof BaseMultiItem) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.44D, tile.getReverseZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
}
counter++;
}
}
}
if (state.getValue(AnvilStone.FACING) == EnumFacing.EAST) {
int counter = 0;
for (int a = 0; a < 5; a++) {
for (int i = 0; i < 5; i++) {
if (!tile.getSlotStack(counter).isEmpty()) {
Item item = tile.getSlotStack(counter).getItem();
if (item.equals(Items.REDSTONE) ||
(item.equals(Items.DYE) && tile.getSlotStack(counter).getItemDamage() == EnumDyeColor.BLUE.getDyeDamage()) ||
item.equals(PrimalItems.EMERALD_KNAPP) ||
item.equals(PrimalItems.DIAMOND_KNAPP) ||
item.equals(Items.DIAMOND) ||
item.equals(Items.EMERALD)
) {
GL11.glPushMatrix();
GL11.glTranslated(tile.getReverseX(a), -0.49D, tile.getNormalZ(i));
GL11.glRotated(-90.0F, 1.0F, 0.0F, 0.0F);
GL11.glScaled(0.25D, 0.25D, 0.25D);
GL11.glRotated(-90.0F, 0.0F, 0.0F, 1.0F);
//GL11.glRotated(-90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item.equals(ModItems.pickaxehead) ||
item.equals(ModItems.cleanironpickaxehead) ||
item.equals(ModItems.steelpickaxehead) ||
item.equals(ModItems.wootzpickaxehead)
) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getReverseX(a), -0.435D, tile.getNormalZ(i));
GL11.glRotated(-90.0F, 0.0F, 1.0F, 0.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item.equals(ModItems.ironaxehead) ||
item.equals(ModItems.cleanironaxehead) ||
item.equals(ModItems.steelaxehead) ||
item.equals(ModItems.wootzaxehead)
) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getReverseX(a), -0.435D, tile.getNormalZ(i));
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item.equals(ModItems.ironshovelhead) ||
item.equals(ModItems.cleanironshovelhead) ||
item.equals(ModItems.steelshovelhead) ||
item.equals(ModItems.steelshovelhead)
) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getReverseX(a), -0.435D, tile.getNormalZ(i));
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item.equals(ModItems.ironhoehead)) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getReverseX(a), -0.435D, tile.getNormalZ(i));
GL11.glRotated(180.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (Block.getBlockFromItem(item) instanceof IngotBall) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getReverseX(a), -0.44D, tile.getNormalZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (item instanceof BaseMultiItem) {
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getReverseX(a), -0.455D, tile.getNormalZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
}
counter++;
}
}
}
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
GL11.glPopMatrix();
}
}
private void doRendering(TileAnvil tile, Integer counter, Integer i, Integer a){
Item item = tile.getSlotStack(counter).getItem();
if(item.equals(Items.REDSTONE) ||
(item.equals(Items.DYE) && tile.getSlotStack(counter).getItemDamage() == EnumDyeColor.BLUE.getDyeDamage()) ||
item.equals(PrimalItems.EMERALD_KNAPP) ||
item.equals(PrimalItems.DIAMOND_KNAPP)
){
GL11.glPushMatrix();
GL11.glTranslated( tile.getNormalX(a), -0.49D, tile.getNormalZ(i) );
GL11.glRotated(-90.0F, 1.0F, -0.0F, 0.0F);
GL11.glScaled(0.25D, 0.25D, 0.25D);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(item.equals(ModItems.pickaxehead)){
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getNormalZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(item.equals(ModItems.ironaxehead)){
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getNormalZ(i));
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(item.equals(ModItems.ironshovelhead)){
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getNormalZ(i));
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(item.equals(ModItems.ironhoehead)){
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getNormalZ(i));
GL11.glRotated(180.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(item == ModItems.ironingotballhot ){
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.44D, tile.getNormalZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if(item == ModItems.ironchunkhot){
GL11.glPushMatrix();
double scale = 1.0D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(tile.getNormalX(a), -0.455D, tile.getNormalZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
}
}

View File

@@ -0,0 +1,79 @@
package nmd.primal.forgecraft.renders.blocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import nmd.primal.forgecraft.blocks.BloomeryBase;
import nmd.primal.forgecraft.tiles.TileBloomery;
import org.lwjgl.opengl.GL11;
/**
* Created by mminaie on 1/22/17.
*/
public class TileBloomeryRender extends TileEntitySpecialRenderer<TileBloomery>
{
private RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
@Override
public void renderTileEntityAt(TileBloomery tile, double x, double y, double z, float partialTicks, int destroyStage) {
BlockPos pos = tile.getPos();
IBlockState state = this.getWorld().getBlockState(pos);
if (state.getBlock() instanceof BloomeryBase) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y + 0.0626D, z + 0.5D);
//GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
float prevLGTX = OpenGlHelper.lastBrightnessX;
float prevLGTY = OpenGlHelper.lastBrightnessY;
int bright = tile.getWorld().getCombinedLight(pos.up(), 0);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, bright % 65536, bright / 65536);
ItemStack stack0 = tile.getSlotStack(0);
ItemStack stack1 = tile.getSlotStack(1);
if (!stack0.isEmpty()) {
boolean is_block = stack0.getItem() instanceof ItemBlock;
float scale = is_block ? 0.1725F : 0.3F;
double xTrans = is_block ? -1.6D : -0.45D;
double yTrans = is_block ? -1.26D : -0.7D;
int stackRotation = stack0.getCount();
GL11.glPushMatrix();
GL11.glScalef(scale, scale, scale);
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack0, renderItem.getItemModelMesher().getItemModel(stack0));
GL11.glPopMatrix();
for (int i = 0; i < Math.ceil(stackRotation / 8) + 1; i++) {
GL11.glPushMatrix();
GL11.glScalef(scale, scale, scale);
GL11.glRotated(45.0F * i, 0.0F, 1.0F, 0.0F);
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(xTrans, yTrans, 0.0D);
renderItem.renderItem(stack0, renderItem.getItemModelMesher().getItemModel(stack0));
GL11.glPopMatrix();
}
}
if (!stack1.isEmpty()) {
GL11.glPushMatrix();
GL11.glTranslated(0, 0.50D, 0);
renderItem.renderItem(stack1, renderItem.getItemModelMesher().getItemModel(stack1));
GL11.glPopMatrix();
}
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
GL11.glPopMatrix();
}
}
}

View File

@@ -0,0 +1,105 @@
package nmd.primal.forgecraft.renders.blocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import nmd.primal.forgecraft.blocks.Breaker;
import nmd.primal.forgecraft.tiles.TileBreaker;
import org.lwjgl.opengl.GL11;
/**
* Created by mminaie on 4/9/17.
*/
public class TileBreakerRender extends TileEntitySpecialRenderer<TileBreaker>
{
private RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
@Override
public void renderTileEntityAt(TileBreaker tile, double x, double y, double z, float partialTicks, int destroyStage) {
BlockPos pos = tile.getPos();
IBlockState state = this.getWorld().getBlockState(pos);
if (state.getBlock() instanceof Breaker) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glScalef(1.0f, 1.0f, 1.0f);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
float prevLGTX = OpenGlHelper.lastBrightnessX;
float prevLGTY = OpenGlHelper.lastBrightnessY;
int bright = tile.getWorld().getCombinedLight(pos.up(), 0);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, bright % 65536, bright / 65536);
//ItemStack stack0 = tile.getSlotStack(0);
if (state.getValue(Breaker.FACING) == EnumFacing.NORTH) {
GL11.glPushMatrix();
GL11.glTranslated(0.5D, 0.450D, 0.7);
GL11.glRotated(90, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(-135, 0.0f, 0.0f, 1.0f);
GL11.glRotatef(tile.getCharge(), 0.0f, 0.0f, 1.0f);
GL11.glTranslatef(0.0f, 0.40f, 0.0f);
GL11.glTranslated(-0.45D, 0.0D, 0.0D);
renderItem.renderItem(tile.getSlotStack(0), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (state.getValue(Breaker.FACING) == EnumFacing.EAST) {
GL11.glPushMatrix();
GL11.glTranslated(0.3D, 0.450D, 0.5);
//GL11.glRotated(90, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(-135, 0.0f, 0.0f, 1.0f);
GL11.glRotatef(tile.getCharge(), 0.0f, 0.0f, 1.0f);
GL11.glTranslatef(0.0f, 0.40f, 0.0f);
GL11.glTranslated(-0.45D, 0.0D, 0.0D);
renderItem.renderItem(tile.getSlotStack(0), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (state.getValue(Breaker.FACING) == EnumFacing.SOUTH) {
GL11.glPushMatrix();
GL11.glTranslated(0.5D, 0.450D, 0.3);
GL11.glRotated(90, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(45, 0.0f, 0.0f, 1.0f);
GL11.glRotatef(tile.getCharge(), 0.0f, 0.0f, -1.0f);
GL11.glTranslatef(0.0f, 0.40f, 0.0f);
GL11.glTranslated(-0.45D, 0.0D, 0.0D);
renderItem.renderItem(tile.getSlotStack(0), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
if (state.getValue(Breaker.FACING) == EnumFacing.WEST) {
GL11.glPushMatrix();
GL11.glTranslated(0.7D, 0.450D, 0.5);
//GL11.glRotated(90, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(45, 0.0f, 0.0f, 1.0f);
GL11.glRotatef(tile.getCharge(), 0.0f, 0.0f, -1.0f);
GL11.glTranslatef(0.0f, 0.40f, 0.0f);
GL11.glTranslated(-0.45D, 0.0D, 0.0D);
renderItem.renderItem(tile.getSlotStack(0), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
GL11.glPopMatrix();
}
}
}

View File

@@ -0,0 +1,103 @@
package nmd.primal.forgecraft.renders.blocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import nmd.primal.forgecraft.blocks.CastingBlock;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.items.casting.CastingPart;
import nmd.primal.forgecraft.tiles.TileCastingBlock;
import org.lwjgl.opengl.GL11;
/**
* Created by mminaie on 6/21/17.
*/
public class TileCastingBlockRender extends TileEntitySpecialRenderer <TileCastingBlock> {
private RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
@Override
public void renderTileEntityAt(TileCastingBlock tile, double x, double y, double z, float partialTicks, int destroyStage) {
BlockPos pos = tile.getPos();
IBlockState state = this.getWorld().getBlockState(pos);
if (state.getBlock() instanceof CastingBlock) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.25D, z + 0.5);
//GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
float prevLGTX = OpenGlHelper.lastBrightnessX;
float prevLGTY = OpenGlHelper.lastBrightnessY;
GL11.glScaled(0.99D, 0.99D, 0.99D);
int bright = tile.getWorld().getCombinedLight(pos.up(), 0);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, bright % 65536, bright / 65536);
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.NORTH) {
if (!tile.getSlotStack(0).isEmpty()) {
Item item = tile.getSlotStack(0).getItem();
if (item instanceof CastingPart) {
GL11.glPushMatrix();
GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
renderItem.renderItem(tile.getSlotStack(0), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
}
}
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.SOUTH) {
if (!tile.getSlotStack(0).isEmpty()) {
Item item = tile.getSlotStack(0).getItem();
if (item instanceof CastingPart) {
GL11.glPushMatrix();
GL11.glRotated(90.0D, 0.0D, 0.0D, 0.0D);
renderItem.renderItem(tile.getSlotStack(0), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
}
}
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.WEST) {
if (!tile.getSlotStack(0).isEmpty()) {
Item item = tile.getSlotStack(0).getItem();
if (item instanceof CastingPart) {
GL11.glPushMatrix();
GL11.glRotated(90.0D, 1.0D, 0.0D, 0.0D);
GL11.glRotated(90.0D, 0.0D, 0.0D, 1.0D);
//GL11.glRotated(180.0D, 0.0D, 1.0D, 0.0D);
renderItem.renderItem(tile.getSlotStack(0), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
}
}
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.EAST) {
if (!tile.getSlotStack(0).isEmpty()) {
Item item = tile.getSlotStack(0).getItem();
if (item instanceof CastingPart) {
GL11.glPushMatrix();
GL11.glRotated(90.0D, 1.0D, 0.0D, 0.0D);
GL11.glRotated(-90.0D, 0.0D, 0.0D, 1.0D);
renderItem.renderItem(tile.getSlotStack(0), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
}
}
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
GL11.glPopMatrix();
}
}
}

View File

@@ -0,0 +1,153 @@
package nmd.primal.forgecraft.renders.blocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import nmd.primal.forgecraft.blocks.CastingForm;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.tiles.TileCastingForm;
import org.lwjgl.opengl.GL11;
/**
* Created by mminaie on 6/21/17.
*/
public class TileCastingformRender extends TileEntitySpecialRenderer <TileCastingForm> {
private RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
@Override
public void renderTileEntityAt(TileCastingForm tile, double x, double y, double z, float partialTicks, int destroyStage) {
BlockPos pos = tile.getPos();
IBlockState state = this.getWorld().getBlockState(pos);
if (state.getBlock() instanceof CastingForm) {
GL11.glPushMatrix();
GL11.glTranslated(x+2/16D, y+0.25D, z+2/16D);
//GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
float prevLGTX = OpenGlHelper.lastBrightnessX;
float prevLGTY = OpenGlHelper.lastBrightnessY;
int bright = tile.getWorld().getCombinedLight(pos.up(), 0);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, bright % 65536, bright / 65536);
/*
NORTH
SLOT | X | Y
0 | 3/16 | 3/16
1 | 5/16 | 3/16
2 | 7/16 | 3/16
3 | 9/16 | 3/16
4 | 11/16 | 3/16
--------------------
5 | 3/16 | 5/16
6 | 5/16 | 5/16
7 | 7/16 | 5/16
8 | 9/16 | 5/16
9 | 11/16 | 5/16
--------------------
10 | 3/16 | 8/16
11 | 5/16 | 8/16
12 | 7/16 | 8/16
13 | 9/16 | 8/16
14 | 11/16 | 8/16
--------------------
15 | 3/16 | 11/16
16 | 5/16 | 11/16
17 | 7/16 | 11/16
18 | 9/16 | 11/16
19 | 11/16 | 11/16
--------------------
20 | 3/16 | 14/16
21 | 5/16 | 14/16
22 | 7/16 | 14/16
23 | 9/16 | 14/16
24 | 11/16 | 14/16
*/
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.NORTH) {
int counter = 0;
for (int i = 0; i < 5; i++) {
for (int a = 0; a < 5; a++) {
if (!tile.getSlotStack(counter).isEmpty()) {
Item item = tile.getSlotStack(counter).getItem();
if (item.equals(ModItems.castingmud)) {
GL11.glPushMatrix();
GL11.glTranslated(tile.getNormalX(a), 0.0D, tile.getNormalZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
}
counter++;
}
}
}
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.SOUTH) {
int counter = 0;
for (int i = 0; i < 5; i++) {
for (int a = 0; a < 5; a++) {
if (!tile.getSlotStack(counter).isEmpty()) {
Item item = tile.getSlotStack(counter).getItem();
if (item.equals(ModItems.castingmud)) {
GL11.glPushMatrix();
GL11.glTranslated(tile.getReverseX(a), 0.0D, tile.getReverseZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
}
counter++;
}
}
}
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.WEST) {
int counter = 0;
for (int a = 0; a < 5; a++) {
for (int i = 0; i < 5; i++) {
if (!tile.getSlotStack(counter).isEmpty()) {
Item item = tile.getSlotStack(counter).getItem();
if (item.equals(ModItems.castingmud)) {
GL11.glPushMatrix();
GL11.glTranslated(tile.getNormalX(a), 0.0D, tile.getReverseZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
}
counter++;
}
}
}
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.EAST) {
int counter = 0;
for (int a = 0; a < 5; a++) {
for (int i = 0; i < 5; i++) {
if (!tile.getSlotStack(counter).isEmpty()) {
Item item = tile.getSlotStack(counter).getItem();
if (item.equals(ModItems.castingmud)) {
GL11.glPushMatrix();
GL11.glTranslated(tile.getReverseX(a), 0.0D, tile.getNormalZ(i));
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
GL11.glPopMatrix();
}
}
counter++;
}
}
}
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
GL11.glPopMatrix();
}
}
}

View File

@@ -0,0 +1,134 @@
package nmd.primal.forgecraft.renders.blocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import nmd.primal.forgecraft.blocks.Forge;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.tiles.TileForge;
import org.lwjgl.opengl.GL11;
/**
* Created by kitsu on 12/4/2016.
*/
public class TileForgeRender extends TileEntitySpecialRenderer<TileForge>
{
private RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
@Override
public void renderTileEntityAt(TileForge tile, double x, double y, double z, float partialTicks, int destroyStage) {
BlockPos pos = tile.getPos();
IBlockState state = this.getWorld().getBlockState(pos);
if (state.getBlock() instanceof Forge) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y + 0.95D, z + 0.5D);
//GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
float prevLGTX = OpenGlHelper.lastBrightnessX;
float prevLGTY = OpenGlHelper.lastBrightnessY;
int bright = tile.getWorld().getCombinedLight(pos.up(), 0);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, bright % 65536, bright / 65536);
ItemStack stack1 = tile.getSlotStack(0);
boolean is_block = stack1.getItem() instanceof ItemBlock;
float scale = is_block ? 0.1725F : 0.3F;
double xTrans = is_block ? -1.6D : -0.45D;
double yTrans = is_block ? -1.26D : 0.75D;
if (!stack1.isEmpty()) {
int stackRotation = stack1.getCount();
GL11.glPushMatrix();
GL11.glScalef(scale, scale, scale);
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack1, renderItem.getItemModelMesher().getItemModel(stack1));
GL11.glPopMatrix();
for (int i = 0; i < Math.ceil(stackRotation / 8) + 1; i++) {
GL11.glPushMatrix();
GL11.glScalef(scale, scale, scale);
GL11.glRotated(45.0F * i, 0.0F, 1.0F, 0.0F);
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(xTrans, yTrans, 0.0D);
renderItem.renderItem(stack1, renderItem.getItemModelMesher().getItemModel(stack1));
GL11.glPopMatrix();
}
}
for (int i = 2; i < tile.getSlotListSize(); i++) {
if (!tile.getSlotStack(i).isEmpty()) {
GL11.glPushMatrix();
float tempScale = 0.8F;
GL11.glScalef(tempScale, tempScale, tempScale);
GL11.glTranslated(0.0F, 0.1D, 0.0F);
if (i == 2) {
GL11.glTranslated(-0.3, -0.05D, -0.3D);
if (tile.getSlotStack(i).getItem() == Items.IRON_INGOT) {
GL11.glScalef(0.5f, 0.5f, 0.5f);
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
}
}
if (i == 3) {
GL11.glTranslated(-0.3, -0.05D, 0.3D);
if (tile.getSlotStack(i).getItem() == Items.IRON_INGOT) {
GL11.glScalef(0.5f, 0.5f, 0.5f);
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
}
}
if (i == 4) {
if (tile.getSlotStack(i).getItem() == Items.IRON_INGOT) {
GL11.glScalef(0.5f, 0.5f, 0.5f);
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
}
//GL11.glScalef(0.6F, 0.6F, 0.6F);
if (tile.getSlotStack(i).getItem() == ModItems.pickaxehead) {
GL11.glRotated(180.0F, 0.0F, 1.0F, 0.0F);
}
if (tile.getSlotStack(i).getItem() == ModItems.ironaxehead) {
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
}
if (tile.getSlotStack(i).getItem() == ModItems.ironshovelhead) {
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
}
if (tile.getSlotStack(i).getItem() == ModItems.ironhoehead) {
GL11.glRotated(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.0, 0.025D, 0.0D);
}
}
if (i == 5) {
GL11.glTranslated(0.3, -0.05D, -0.3D);
if (tile.getSlotStack(i).getItem() == Items.IRON_INGOT) {
GL11.glScalef(0.5f, 0.5f, 0.5f);
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
}
}
if (i == 6) {
GL11.glTranslated(0.3, -0.05D, 0.3D);
if (tile.getSlotStack(i).getItem() == Items.IRON_INGOT) {
GL11.glScalef(0.5f, 0.5f, 0.5f);
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
}
}
renderItem.renderItem(tile.getSlotStack(i), ItemCameraTransforms.TransformType.FIXED);
//renderItem.renderItem(tile.getSlotStack(i), renderItem.getItemModelMesher().getItemModel(tile.getSlotStack(i)));
GL11.glPopMatrix();
}
}
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
GL11.glPopMatrix();
}
}
}

View File

@@ -0,0 +1,94 @@
package nmd.primal.forgecraft.renders.blocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.forgecraft.blocks.PistonBellows;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.tiles.TilePistonBellows;
import org.lwjgl.opengl.GL11;
/**
* Created by mminaie on 1/7/17.
*/
public class TilePistonBellowsRender extends TileEntitySpecialRenderer<TilePistonBellows> {
private RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
@Override
public void renderTileEntityAt(TilePistonBellows tile, double x, double y, double z, float partialTicks, int destroyStage)
{
BlockPos pos = tile.getPos();
IBlockState state = this.getWorld().getBlockState(pos);
if (state.getBlock() instanceof PistonBellows) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y + 0.5D, z + 0.5D);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
float prevLGTX = OpenGlHelper.lastBrightnessX;
float prevLGTY = OpenGlHelper.lastBrightnessY;
int bright = tile.getWorld().getCombinedLight(pos.up(), 0);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, bright % 65536, bright / 65536);
GL11.glPushMatrix();
if (state.getValue(PistonBellows.FACING) == EnumFacing.NORTH) {
GL11.glRotated(0, 0.0F, 1.0F, 0.0F);
if (state.getValue(PrimalStates.ACTIVE) == Boolean.TRUE) {
//System.out.println(tile.getAnimation());
GL11.glTranslated(0.0D, 0, (double) tile.getAnimation() / 25);
}
ItemStack stackToRender = new ItemStack(ModItems.bellowshandle, 1);
renderItem.renderItem(stackToRender, renderItem.getItemModelMesher().getItemModel(stackToRender));
}
if (state.getValue(PistonBellows.FACING) == EnumFacing.SOUTH) {
//GL11.glPushMatrix();
GL11.glRotated(180, 0.0F, 1.0F, 0.0F);
if (state.getValue(PrimalStates.ACTIVE) == Boolean.TRUE) {
//System.out.println(tile.getAnimation());
GL11.glTranslated(0.0D, 0, (double) tile.getAnimation() / 25);
}
ItemStack stackToRender = new ItemStack(ModItems.bellowshandle, 1);
renderItem.renderItem(stackToRender, renderItem.getItemModelMesher().getItemModel(stackToRender));
//GL11.glPopMatrix();
}
if (state.getValue(PistonBellows.FACING) == EnumFacing.EAST) {
//GL11.glPushMatrix();
GL11.glRotated(270, 0.0F, 1.0F, 0.0F);
if (state.getValue(PrimalStates.ACTIVE) == Boolean.TRUE) {
//System.out.println(tile.getAnimation());
GL11.glTranslated(0.0D, 0, (double) tile.getAnimation() / 25);
}
ItemStack stackToRender = new ItemStack(ModItems.bellowshandle, 1);
renderItem.renderItem(stackToRender, renderItem.getItemModelMesher().getItemModel(stackToRender));
//GL11.glPopMatrix();
}
if (state.getValue(PistonBellows.FACING) == EnumFacing.WEST) {
//GL11.glPushMatrix();
GL11.glRotated(90, 0.0F, 1.0F, 0.0F);
if (state.getValue(PrimalStates.ACTIVE) == Boolean.TRUE) {
//System.out.println(tile.getAnimation());
GL11.glTranslated(0.0D, 0, (double) tile.getAnimation() / 25);
}
ItemStack stackToRender = new ItemStack(ModItems.bellowshandle, 1);
renderItem.renderItem(stackToRender, renderItem.getItemModelMesher().getItemModel(stackToRender));
//GL11.glPopMatrix();
}
GL11.glPopMatrix();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
GL11.glPopMatrix();
}
}
}

View File

@@ -0,0 +1,48 @@
package nmd.primal.forgecraft.renders.items;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableMap;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.IModelCustomData;
import net.minecraftforge.common.model.IModelState;
import java.util.Collection;
/**
* Created by mminaie on 3/8/17.
*/
public class ModelPickaxe implements IModel, IModelCustomData {
public static final IModel MODEL = new ModelPickaxe();
//private final ResourceLocation resourceHead;
//private final ResourceLocation resourceHandle;
@Override
public IModel process(ImmutableMap<String, String> customData) {
return null;
}
@Override
public Collection<ResourceLocation> getDependencies() {
return null;
}
@Override
public Collection<ResourceLocation> getTextures() {
return null;
}
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
return null;
}
@Override
public IModelState getDefaultState() {
return null;
}
}

View File

@@ -0,0 +1,76 @@
package nmd.primal.forgecraft.tiles;
import net.minecraft.block.state.IBlockState;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
* Created by kitsu on 12/3/2016.
*/
public abstract class BaseTile extends TileEntity {
@Override
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate)
{
return oldState.getBlock() != newSate.getBlock();
}
public void updateBlock()
{
// might be good
//this.markDirty();
World world = this.getWorld();
IBlockState state = world.getBlockState(this.pos);
world.notifyBlockUpdate(this.pos, state, state, 3);
}
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
this.readNBT(nbt);
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
nbt = super.writeToNBT(nbt);
return this.writeNBT(nbt);
}
public NBTTagCompound readNBT(NBTTagCompound nbt)
{
// Override in lower tile classes
return nbt;
}
public NBTTagCompound writeNBT(NBTTagCompound nbt)
{
// Override in lower tile classes
return nbt;
}
// ***************************************************************************** //
// Packets
// ***************************************************************************** //
@Override
public NBTTagCompound getUpdateTag()
{
return writeToNBT(new NBTTagCompound());
}
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
return new SPacketUpdateTileEntity(this.pos, 0, this.writeNBT(new NBTTagCompound()));
}
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
this.readNBT(packet.getNbtCompound());
}
}

View File

@@ -0,0 +1,82 @@
package nmd.primal.forgecraft.tiles;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ITickable;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.parts.ToolPart;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 3/4/17.
*/
public class TileAnvil extends TileBaseSlot implements ITickable {
double[] normalX = {0.125,0.3125,0.5,0.6875,0.875};
public double getNormalX(Integer x) {
return normalX[x];
}
double[] normalZ = {0.125,0.3125,0.5,0.6875,0.875};
public double getNormalZ(Integer z) {
return normalZ[z];
}
double[] reverseX = {0.875,0.6875,0.5,0.3125,0.125};
public double getReverseX(Integer x) {
return reverseX[x];
}
double[] reverseZ = {0.875,0.6875,0.5,0.3125,0.125};
public double getReverseZ(Integer z) {
return reverseZ[z];
}
public NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(100, ItemStack.EMPTY);
@Override
public void update () {
World world = this.getWorld();
if (!world.isRemote) {
IBlockState state = world.getBlockState(this.pos);
if ( ThreadLocalRandom.current().nextInt(0,10000) == 0 ) {
for(int i=0; i<this.getSlotListSize(); i++){
if(this.getSlotStack(i).getItem() == ModItems.ironchunkhot){
if(ThreadLocalRandom.current().nextInt(0,1000) == 1){
this.setSlotStack(i, new ItemStack(ModBlocks.ironchunk, 1));
this.updateBlock();
this.markDirty();
}
}
if(this.getSlotStack(i).getItem() == ModItems.ironingotballhot){
if(ThreadLocalRandom.current().nextInt(0,1000) == 2){
this.setSlotStack(i, new ItemStack(ModBlocks.ironball, 1));
this.updateBlock();
this.markDirty();
}
}
if(this.getSlotStack(i).getItem() instanceof ToolPart){
if(ThreadLocalRandom.current().nextInt(0,1000) == 3){
((ToolPart) this.getSlotStack(i).getItem()).setHot(this.getSlotStack(i), false);
this.updateBlock();
this.markDirty();
}
}
}
}
}
}
}

View File

@@ -0,0 +1,39 @@
package nmd.primal.forgecraft.tiles;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ITickable;
import net.minecraft.world.World;
import nmd.primal.forgecraft.crafting.BloomeryCrafting;
/**
* Created by mminaie on 2/4/17.
*/
public class TileBaseCrucible extends BaseTile implements ITickable {
private int iteration = 0;
public int countdown = 0;
@Override
public void update () {
if (!world.isRemote) {
World world = this.getWorld();
IBlockState state = world.getBlockState(this.pos);
iteration++;
//System.out.println(iteration);
if(iteration == 100 ){
iteration = 0;
countdown += 100;
//System.out.println(countdown);
BloomeryCrafting recipe = BloomeryCrafting.getRecipeFromOutput(new ItemStack(state.getBlock(), 1));
if(recipe != null){
if (countdown > recipe.getCooldown()){
world.setBlockState(this.pos, Block.getBlockFromItem(recipe.getCoolOutput().getItem()).getDefaultState(), 3);
countdown = 0;
}
}
}
}
}
}

View File

@@ -0,0 +1,109 @@
package nmd.primal.forgecraft.tiles;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.NonNullList;
import java.util.List;
/**
* Created by mminaie on 12/25/16.
*/
public abstract class TileBaseSlot extends BaseTile {
public NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(100, ItemStack.EMPTY);
// ***************************************************************************** //
// Controls
// ***************************************************************************** //
// ***************************************************************************** //
// get
//
public NonNullList<ItemStack> getSlotList()
{
return this.slotList;
}
public ItemStack getSlotStack(int i)
{
return this.slotList.get(i);
}
public int getSlotListSize()
{
return slotList.size();
}
public int getSlotLimit()
{
//return ((ShelfBasic)this.getBlockType()).getShelfSize();
//return 1;
return 64;
}
public ItemStack decrStackSize(int index, int count)
{
return ItemStackHelper.getAndSplit(this.getSlotList(), index, count);
}
public ItemStack incrementStackSize(List<ItemStack> stacks, int index, int count) {
Integer tempCount = ((ItemStack)stacks.get(index)).getCount();
ItemStack tempStack = ((ItemStack)stacks.get(index));
if(tempCount + count > 64) {
tempStack.setCount(64);
}
if(tempCount + count <= 64) {
tempStack.setCount(tempCount + count);
}
return tempStack;
}
// ***************************************************************************** //
// set
//
public void setSlotStack(int index, ItemStack stack)
{
this.slotList.set(index, stack);
this.markDirty();
this.updateBlock();
}
public void clearSlots()
{
this.slotList.clear();
this.markDirty();
this.updateBlock();
}
public void clearSlot(int index) {
this.slotList.set(index, ItemStack.EMPTY);
this.markDirty();
this.updateBlock();
}
// ***************************************************************************** //
// NBT
// ***************************************************************************** //
@Override
public NBTTagCompound readNBT(NBTTagCompound nbt)
{
//super.readNBT(nbt);
this.slotList = NonNullList.<ItemStack>withSize(this.getSlotListSize(), ItemStack.EMPTY);
ItemStackHelper.loadAllItems(nbt, this.slotList);
return nbt;
}
@Override
public NBTTagCompound writeNBT(NBTTagCompound nbt)
{
//super.writeNBT(nbt);
ItemStackHelper.saveAllItems(nbt, this.slotList);
return nbt;
}
}

View File

@@ -0,0 +1,262 @@
package nmd.primal.forgecraft.tiles;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ITickable;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import nmd.primal.core.api.PrimalItems;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.blocks.BloomeryBase;
import nmd.primal.forgecraft.blocks.Crucibles.Crucible;
import nmd.primal.forgecraft.crafting.BloomeryCrafting;
import nmd.primal.forgecraft.init.ModItems;
import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
import static nmd.primal.forgecraft.CommonUtils.getVanillaItemBurnTime;
/**
* Created by mminaie on 1/22/17.
*/
public class TileBloomery extends TileBaseSlot implements ITickable {
private NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(3, ItemStack.EMPTY);
private int iteration = 0;
private int heat;
private int cookCounter;
@Override
public void update () {
World world = this.getWorld();
if(!world.isRemote){
IBlockState state = world.getBlockState(this.pos);
if(state.getValue(PrimalStates.ACTIVE) == true) {
if (this.getHeat() < 100) {
this.setHeat(100);
}
this.iteration++;
if (this.iteration == 300) {
this.iteration = 0;
//IBlockState state = world.getBlockState(this.pos);
BlockPos abovePos = new BlockPos(this.getPos().getX(), this.getPos().getY() + 1, this.getPos().getZ());
if (this.getSlotStack(0) == ItemStack.EMPTY) {
world.setBlockState(this.getPos(), state.withProperty(PrimalStates.ACTIVE, false), 2);
this.markDirty();
world.notifyBlockUpdate(pos, state, state, 2);
}
this.heatManager(this.getHeat(), state, this.getSlotStack(0), world, pos);
}
slotZeroManager(world);
slotOneManager();
}
}
}
private void slotOneManager(){
BloomeryCrafting recipe = BloomeryCrafting.getRecipe(this.getSlotStack(1));
if(recipe != null){
//System.out.println(recipe.getIdealTime() + " : " + recipe.getHeatThreshold());
//System.out.println(this.cookCounter + " : " + this.getHeat());
//System.out.println("====================");
if(this.getHeat() >= recipe.getHeatThreshold()){
cookCounter++;
}
if(cookCounter >= recipe.getIdealTime() ){
if(this.getSlotStack(1).getItem() == recipe.getInput().getItem()) {
this.setSlotStack(1, recipe.getOutput());
//this.cookCounter = 0;
//System.out.print(" :Success: " + this.getSlotStack(1));
this.updateBlock();
this.markDirty();
}
}
if(cookCounter > recipe.getIdealTime() + (recipe.getIdealTime() * recipe.getTimeVariance())){
if(this.getSlotStack(1).getItem() == recipe.getOutput().getItem()) {
this.setSlotStack(1, recipe.getOutputFailed());
this.cookCounter = 0;
//System.out.print(" :Failure Time: " + this.getSlotStack(1));
this.updateBlock();
this.markDirty();
}
}
if(this.getHeat() > recipe.getHeatThreshold() + (recipe.getHeatThreshold() * recipe.getHeatVariance())){
if(this.getSlotStack(1).getItem() == recipe.getInput().getItem()) {
this.setSlotStack(1, recipe.getOutputFailed());
this.cookCounter = 0;
//System.out.print(" :Failure Heat: " + this.getSlotStack(1));
this.updateBlock();
this.markDirty();
}
}
if (this.getSlotStack(1).isEmpty()){
this.cookCounter=0;
}
}
}
private void slotZeroManager(World world){
if(this.getSlotStack(0) != ItemStack.EMPTY) {
Integer decrInt = (int) Math.floor(getVanillaItemBurnTime(this.getSlotStack(0)) / 5);
if(decrInt == 0) {
decrInt = 1;
}
Integer size = this.getSlotStack(0).getCount();
Integer burnModifier = 0;
if(size / 16 <= 1){
burnModifier = 1;
}
if(size / 16 > 1 && size / 16 <= 2){
burnModifier = 2;
}
if(size / 16 > 2 && size / 16 <= 3){
burnModifier = 3;
}
if(size / 16 > 3 && size / 16 <= 4){
burnModifier = 4;
}
if (world.rand.nextInt(decrInt) == 0) {
if (world.rand.nextInt(burnModifier) == 0) {
System.out.println("Fuel Burn" + this.getSlotStack(0));
this.decrStackSize(0, 1);
this.markDirty();
this.updateBlock();
}
}
if (this.getSlotStack(0).getCount() == 1){
this.decrStackSize(0, 1);
this.markDirty();
this.updateBlock();
}
if(CommonUtils.randomCheck(1000)) {
makeSmoke(world, pos);
}
}
}
public int getHeat(){
return this.heat;
}
public void setHeat(int newHeat){
this.heat = newHeat;
}
public int getCookCounter() {return this.cookCounter; }
@Override
public int getSlotLimit() {
return 1;
}
private void heatManager(Integer h, IBlockState state, ItemStack stack, World world, BlockPos pos){
if(state.getValue(PrimalStates.ACTIVE) == true){
if(!stack.isEmpty()) {
if(h > 0) {
this.setHeat(h - 25);
}
if(h < 10 ){
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, false), 2);
}
}
if(stack.isEmpty()){
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, false), 2);
}
if(this.getSlotStack(0).getItem() == PrimalItems.CHARCOAL_FAIR){
if(this.getHeat() > 1610){
this.setHeat(1600);
}
}
if(this.getSlotStack(0).getItem() == Items.COAL && this.getSlotStack(0).getMetadata() == 1){
if(this.getHeat() > 1210){
this.setHeat(1200);
}
}
if(this.getSlotStack(0).getItem() == PrimalItems.CHARCOAL_GOOD){
if(this.getHeat() > 2110){
this.setHeat(2100);
}
}
if(this.getSlotStack(0).getItem() == PrimalItems.CHARCOAL_HIGH){
if(this.getHeat() > 3510){
this.setHeat(3500);
}
}
}
if(state.getValue(PrimalStates.ACTIVE) == false){
if(h > 50){
this.setHeat(h - 50);
}
if(h < 0){
this.setHeat(0);
}
}
if(world.getBlockState(pos).getBlock() instanceof BloomeryBase){
BloomeryBase tempBlock = (BloomeryBase) world.getBlockState(pos).getBlock();
if(this.getHeat() > tempBlock.getMaxHeat()){
world.setBlockState(pos, Blocks.FIRE.getDefaultState(), 2);
//world.markTileEntityForRemoval(this);
}
}
this.updateBlock();
this.markDirty();
}
public ItemStack removeStackFromSlot(int index) {
ItemStack stack = this.getSlotStack(index);
this.setSlotStack(index, ItemStack.EMPTY);
return stack;
}
public boolean isItemValidForSlot(int index, ItemStack stack) {
if(index == 0){
if(stack.getItem() == Items.COAL){
if(stack.getMetadata() == 1) {
return true;
}
}
if(stack.getItem() == PrimalItems.CHARCOAL_GOOD
|| stack.getItem() == PrimalItems.CHARCOAL_HIGH
|| stack.getItem() == PrimalItems.CHARCOAL_FAIR){
return true;
}
}
if(index == 1){
if (stack.getItem() == ModItems.softcrucible) {
return true;
}
if(Block.getBlockFromItem(stack.getItem()) instanceof Crucible ){
return true;
}
}
return false;
}
// ***************************************************************************** //
// NBT
// ***************************************************************************** //
@Override
public NBTTagCompound readNBT(NBTTagCompound nbt)
{
super.readNBT(nbt);
this.heat = nbt.getInteger("heat");
this.cookCounter = nbt.getInteger("cook");
return nbt;
}
@Override
public NBTTagCompound writeNBT(NBTTagCompound nbt)
{
nbt.setInteger("heat", this.heat);
nbt.setInteger("cook", this.cookCounter);
super.writeNBT(nbt);
return nbt;
}
}

View File

@@ -0,0 +1,49 @@
package nmd.primal.forgecraft.tiles;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.NonNullList;
/**
* Created by mminaie on 4/9/17.
*/
public class TileBreaker extends TileBaseSlot {
private float charge = 0.0f;
public float getCharge() {
return charge;
}
public void setCharge(float a) {
this.charge = a;
this.updateBlock();
}
public NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
@Override
public int getSlotLimit() {
return 1;
}
// ***************************************************************************** //
// NBT
// ***************************************************************************** //
@Override
public NBTTagCompound readNBT(NBTTagCompound nbt)
{
super.readNBT(nbt);
this.charge = nbt.getFloat("charge");
return nbt;
}
@Override
public NBTTagCompound writeNBT(NBTTagCompound nbt)
{
nbt.setFloat("charge", this.charge);
super.writeNBT(nbt);
return nbt;
}
}

View File

@@ -0,0 +1,14 @@
package nmd.primal.forgecraft.tiles;
/**
* Created by mminaie on 6/24/17.
*/
public class TileCastingBlock extends TileBaseSlot {
@Override
public int getSlotLimit() {
return 1;
}
}

View File

@@ -0,0 +1,38 @@
package nmd.primal.forgecraft.tiles;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
/**
* Created by mminaie on 6/19/17.
*/
public class TileCastingForm extends TileBaseSlot {
double[] normalX = {2/16D, 4/16D, 6/16D, 8/16D, 10/16D};
public double getNormalX(Integer x) {
return normalX[x];
}
double[] normalZ = {2/16D, 4/16D, 6/16D, 8/16D, 10/16D};
public double getNormalZ(Integer z) {
return normalZ[z];
}
double[] reverseX = {10/16D, 8/16D, 6/16D, 4/16D, 2/16D};
public double getReverseX(Integer x) {
return reverseX[x];
}
double[] reverseZ = {10/16D, 8/16D, 6/16D, 4/16D, 2/16D};
public double getReverseZ(Integer z) {
return reverseZ[z];
}
public NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(100, ItemStack.EMPTY);
}

View File

@@ -0,0 +1,304 @@
package nmd.primal.forgecraft.tiles;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ITickable;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import nmd.primal.core.api.PrimalItems;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.blocks.Forge;
import nmd.primal.forgecraft.crafting.ForgeCrafting;
import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
import static nmd.primal.forgecraft.CommonUtils.getVanillaItemBurnTime;
/**
* Created by mminaie on 11/30/16.
*/
public class TileForge extends TileBaseSlot implements ITickable {
private NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(7, ItemStack.EMPTY);
//private ItemStack[] inventory = new ItemStack [0];
//private String customName;
private int iteration = 0;
private int heat;
private int cookCounter2, cookCounter3, cookCounter4, cookCounter5, cookCounter6;
@Override
public void update () {
if(!world.isRemote) {
World world = this.getWorld();
this.iteration++;
IBlockState state = world.getBlockState(this.pos);
BlockPos abovePos = new BlockPos(this.getPos().getX(), this.getPos().getY() + 1, this.getPos().getZ());
IBlockState aboveState = world.getBlockState(abovePos);
Block block = world.getBlockState(abovePos).getBlock();
if (world.getBlockState(this.getPos()).getValue(PrimalStates.ACTIVE)) {
if (this.iteration == 300) {
this.iteration = 0;
if (this.getSlotStack(0) == ItemStack.EMPTY) {
world.setBlockState(this.getPos(), state.withProperty(PrimalStates.ACTIVE, false), 2);
this.markDirty();
world.notifyBlockUpdate(pos, state, state, 2);
}
this.heatManager(this.getHeat(), state, this.getSlotStack(0), world, pos);
}
slotZeroManager(world);
craftingManager();
}
}
}
private void slotZeroManager(World world){
if(this.getSlotStack(0) != ItemStack.EMPTY) {
Integer decrInt = (int) Math.floor(getVanillaItemBurnTime(this.getSlotStack(0)) / 5);
if(decrInt == 0) {
decrInt = 1;
}
Integer size = this.getSlotStack(0).getCount();
Integer burnModifier = 0;
if(size / 16 <= 1){
burnModifier = 1;
}
if(size / 16 > 1 && size / 16 <= 2){
burnModifier = 2;
}
if(size / 16 > 2 && size / 16 <= 3){
burnModifier = 3;
}
if(size / 16 > 3 && size / 16 <= 4){
burnModifier = 4;
}
if (world.rand.nextInt(decrInt) == 0) {
if (world.rand.nextInt(burnModifier) == 0) {
System.out.println("Fuel Burn" + this.getSlotStack(0));
this.decrStackSize(0, 1);
this.markDirty();
this.updateBlock();
}
}
if (this.getSlotStack(0).getCount() == 1){
this.decrStackSize(0, 1);
this.markDirty();
this.updateBlock();
}
if(CommonUtils.randomCheck(1000)) {
makeSmoke(world, pos);
}
}
}
private void heatManager(Integer h, IBlockState state, ItemStack stack, World world, BlockPos pos){
if(state.getValue(PrimalStates.ACTIVE) == true){
if(!stack.isEmpty()) {
if(h > 0) {
this.setHeat(h - 25);
}
if(h < 10 ){
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, false), 2);
}
}
if(stack.isEmpty()){
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, false), 2);
}
if(this.getSlotStack(0).getItem() == PrimalItems.CHARCOAL_FAIR){
if(this.getHeat() > 1610){
this.setHeat(1600);
}
}
if(this.getSlotStack(0).getItem() == Items.COAL && this.getSlotStack(0).getMetadata() == 1){
if(this.getHeat() > 1210){
this.setHeat(1200);
}
}
if(this.getSlotStack(0).getItem() == PrimalItems.CHARCOAL_GOOD){
if(this.getHeat() > 2110){
this.setHeat(2100);
}
}
if(this.getSlotStack(0).getItem() == PrimalItems.CHARCOAL_HIGH){
if(this.getHeat() > 3510){
this.setHeat(3500);
}
}
}
if(state.getValue(PrimalStates.ACTIVE) == false){
if(h > 50){
this.setHeat(h - 50);
}
if(h < 0){
this.setHeat(0);
}
}
if(world.getBlockState(pos).getBlock() instanceof Forge){
Forge tempBlock = (Forge) world.getBlockState(pos).getBlock();
if(this.getHeat() > tempBlock.getMaxHeat()){
world.setBlockState(pos, Blocks.FIRE.getDefaultState(), 2);
//world.markTileEntityForRemoval(this);
}
}
this.updateBlock();
this.markDirty();
}
private void craftingManager() {
for (int i = 2; i < this.getSlotListSize(); i++) {
Item itemTest = this.getSlotStack(i).getItem();
ForgeCrafting recipe = ForgeCrafting.getRecipe(itemTest);
if (recipe != null) {
if(i == 2){
if (this.getHeat() >= recipe.getHeatThreshold()) {
cookCounter2++;
}
if (this.getHeat() < recipe.getHeatThreshold() && cookCounter2 > 0) {
cookCounter2--;
}
if (cookCounter2 >= recipe.getIdealTime()) {
if(this.getSlotStack(i).hasTagCompound()){
this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true);
} else this.setSlotStack(i, recipe.getOutput());
cookCounter2 = 0;
}
}
if(i == 3){
if (this.getHeat() >= recipe.getHeatThreshold()) {
cookCounter3++;
}
if (this.getHeat() < recipe.getHeatThreshold() && cookCounter3 > 0) {
cookCounter3--;
}
if (cookCounter3 >= recipe.getIdealTime()) {
if(this.getSlotStack(i).hasTagCompound()){
this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true);
} else this.setSlotStack(i, recipe.getOutput());
cookCounter3 = 0;
}
}
if(i == 4){
if (this.getHeat() >= recipe.getHeatThreshold()) {
cookCounter4++;
}
if (this.getHeat() < recipe.getHeatThreshold() && cookCounter4 > 0) {
cookCounter4--;
}
if (cookCounter4 >= recipe.getIdealTime()) {
if(this.getSlotStack(i).hasTagCompound()){
if( this.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == false) {
this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true);
//System.out.println(this.getSlotStack(i).getSubCompound("tags"));
//System.out.println("its hot now");
cookCounter4 = 0;
}
} else this.setSlotStack(i, recipe.getOutput());
cookCounter4 = 0;
}
}
if(i == 5){
if (this.getHeat() >= recipe.getHeatThreshold()) {
cookCounter5++;
}
if (this.getHeat() < recipe.getHeatThreshold() && cookCounter5 > 0) {
cookCounter5--;
}
if (cookCounter5 >= recipe.getIdealTime()) {
if(this.getSlotStack(i).hasTagCompound()){
this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true);
} else this.setSlotStack(i, recipe.getOutput());
cookCounter5 = 0;
}
}
if(i == 6){
if (this.getHeat() >= recipe.getHeatThreshold()) {
cookCounter6++;
}
if (this.getHeat() < recipe.getHeatThreshold() && cookCounter6 > 0) {
cookCounter6--;
}
if (cookCounter6 >= recipe.getIdealTime()) {
if(this.getSlotStack(i).hasTagCompound()){
this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true);
} else this.setSlotStack(i, recipe.getOutput());
cookCounter6 = 0;
}
}
/*
System.out.println(state.getValue(IngotBall.ACTIVE) + " : " + recipe.getStartState());
System.out.println(cookCounter + " : " + recipe.getIdealTime());
System.out.println(this.heat + " : " + recipe.getHeatThreshold());
System.out.println("========");
*/
}
}
}
public int getHeat(){
return this.heat;
}
public void setHeat(int newHeat){
this.heat = newHeat;
}
@Override
public int getSlotLimit() {
return 1;
}
public ItemStack removeStackFromSlot(int index) {
ItemStack stack = this.getSlotStack(index);
this.setSlotStack(index, ItemStack.EMPTY);
return stack;
}
public boolean isItemValidForSlot(int index, ItemStack stack) {
if(index == 0){
if(stack.getItem() == Items.COAL){
if(stack.getMetadata() == 1) {
return true;
}
}
if(stack.getItem() == PrimalItems.CHARCOAL_GOOD
|| stack.getItem() == PrimalItems.CHARCOAL_HIGH
|| stack.getItem() == PrimalItems.CHARCOAL_FAIR){
return true;
}
}
return false;
}
// ***************************************************************************** //
// NBT
// ***************************************************************************** //
@Override
public NBTTagCompound readNBT(NBTTagCompound nbt)
{
super.readNBT(nbt);
this.heat = nbt.getInteger("heat");
return nbt;
}
@Override
public NBTTagCompound writeNBT(NBTTagCompound nbt)
{
nbt.setInteger("heat", this.heat);
super.writeNBT(nbt);
return nbt;
}
}

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