initial commit
This commit is contained in:
commit
7e6af7e71e
|
@ -0,0 +1,431 @@
|
||||||
|
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS
|
||||||
|
COOPERATIVE NON-VIOLENT PUBLIC LICENSE (\"LICENSE\"). THE WORK IS
|
||||||
|
PROTECTED BY COPYRIGHT AND ALL OTHER APPLICABLE LAWS. ANY USE OF THE
|
||||||
|
WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS
|
||||||
|
PROHIBITED. BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED IN THIS
|
||||||
|
LICENSE, YOU AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE.TO THE
|
||||||
|
EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR
|
||||||
|
GRANTS YOU THE RIGHTS CONTAINED HERE IN AS CONSIDERATION FOR ACCEPTING
|
||||||
|
THE TERMS AND CONDITIONS OF THIS LICENSE AND FOR AGREEING TO BE BOUND BY
|
||||||
|
THE TERMS AND CONDITIONS OF THIS LICENSE.
|
||||||
|
|
||||||
|
# Definitions
|
||||||
|
|
||||||
|
An Act of War is any action of one country against any group either with
|
||||||
|
an intention to provoke a conflict or an action that occurs during a
|
||||||
|
declared war or during armed conflict between military forces of any
|
||||||
|
origin. This includes but is not limited to enforcing sanctions or
|
||||||
|
sieges, supplying armed forces, or profiting from the manufacture of
|
||||||
|
tools or weaponry used in military conflict.
|
||||||
|
|
||||||
|
An Adaptation is a work based upon the Work, or upon the Work and other
|
||||||
|
pre-existing works, such as a translation, adaptation, derivative work,
|
||||||
|
arrangement of music or other alterations of a literary or artistic
|
||||||
|
work, or phonogram or performance and includes cinematographic
|
||||||
|
adaptations or any other form in which the Work may be recast,
|
||||||
|
transformed, or adapted including in any form recognizably derived from
|
||||||
|
the original, except that a work that constitutes a Collection will not
|
||||||
|
be considered an Adaptation for the purpose of this License. For the
|
||||||
|
avoidance of doubt, where the Work is a musical work, performance or
|
||||||
|
phonogram, the synchronization of the Work in timed-relation with a
|
||||||
|
moving image (\"synching\") will be considered an Adaptation for the
|
||||||
|
purpose of this License. In addition, where the Work is designed to
|
||||||
|
output a neural network the output of the neural network will be
|
||||||
|
considered an Adaptation for the purpose of this license.
|
||||||
|
|
||||||
|
Bodily Harm is any physical hurt or injury to a person that interferes
|
||||||
|
with the health or comfort of the person and that is more than merely
|
||||||
|
transient or trifling in nature.
|
||||||
|
|
||||||
|
Distribute is to make available to the public the original and copies of
|
||||||
|
the Work or Adaptation, as appropriate, through sale, gift or any other
|
||||||
|
transfer of possession or ownership.
|
||||||
|
|
||||||
|
Incarceration is Confinement in a jail, prison, or any other place where
|
||||||
|
individuals of any kind are held against either their will or (if their
|
||||||
|
will cannot be determined) the will of their legal guardian or
|
||||||
|
guardians. In the case of a conflict between the will of the individual
|
||||||
|
and the will of their legal guardian or guardians, the will of the
|
||||||
|
individual will take precedence.
|
||||||
|
|
||||||
|
Licensor is The individual, individuals, entity, or entities that
|
||||||
|
offer(s) the Work under the terms of this License
|
||||||
|
|
||||||
|
Original Author is in the case of a literary or artistic work, the
|
||||||
|
individual, individuals, entity or entities who created the Work or if
|
||||||
|
no individual or entity can be identified, the publisher; and in
|
||||||
|
addition
|
||||||
|
|
||||||
|
- in the case of a performance the actors, singers, musicians,
|
||||||
|
dancers, and other persons who act, sing, deliver, declaim, play in,
|
||||||
|
interpret or otherwise perform literary or artistic works or
|
||||||
|
expressions of folklore;
|
||||||
|
|
||||||
|
- in the case of a phonogram the producer being the person or legal
|
||||||
|
entity who first fixes the sounds of a performance or other sounds;
|
||||||
|
and,
|
||||||
|
|
||||||
|
- in the case of broadcasts, the organization that transmits the
|
||||||
|
broadcast.
|
||||||
|
|
||||||
|
Work is the literary and/or artistic work offered under the terms of
|
||||||
|
this License including without limitation any production in the
|
||||||
|
literary, scientific and artistic domain, whatever may be the mode or
|
||||||
|
form of its expression including digital form, such as a book, pamphlet
|
||||||
|
and other writing; a lecture, address, sermon or other work of the same
|
||||||
|
nature; a dramatic or dramatico-musical work; a choreographic work or
|
||||||
|
entertainment in dumb show; a musical composition with or without words;
|
||||||
|
a cinematographic work to which are assimilated works expressed by a
|
||||||
|
process analogous to cinematography; a work of drawing, painting,
|
||||||
|
architecture, sculpture, engraving or lithography; a photographic work
|
||||||
|
to which are assimilated works expressed by a process analogous to
|
||||||
|
photography; a work of applied art; an illustration, map, plan, sketch
|
||||||
|
or three-dimensional work relative to geography, topography,
|
||||||
|
architecture or science; a performance; a broadcast; a phonogram; a
|
||||||
|
compilation of data to the extent it is protected as a copyrightable
|
||||||
|
work; or a work performed by a variety or circus performer to the extent
|
||||||
|
it is not otherwise considered a literary or artistic work.
|
||||||
|
|
||||||
|
You means an individual or entity exercising rights under this License
|
||||||
|
who has not previously violated the terms of this License with respect
|
||||||
|
to the Work, or who has received express permission from the Licensor to
|
||||||
|
exercise rights under this License despite a previous violation.
|
||||||
|
|
||||||
|
Publicly Perform means to perform public recitations of the Work and to
|
||||||
|
communicate to the public those public recitations, by any means or
|
||||||
|
process, including by wire or wireless means or public digital
|
||||||
|
performances; to make available to the public Works in such a way that
|
||||||
|
members of the public may access these Works from a place and at a place
|
||||||
|
individually chosen by them; to perform the Work to the public by any
|
||||||
|
means or process and the communication to the public of the performances
|
||||||
|
of the Work, including by public digital performance; to broadcast and
|
||||||
|
rebroadcast the Work by any means including signs, sounds or images.
|
||||||
|
|
||||||
|
Reproduce is to make copies of the Work by any means including without
|
||||||
|
limitation by sound or visual recordings and the right of fixation and
|
||||||
|
reproducing fixations of the Work, including storage of a protected
|
||||||
|
performance or phonogram in digital form or other electronic medium.
|
||||||
|
|
||||||
|
Software is any digital Work which, through use of a third-party piece
|
||||||
|
of Software or through the direct usage of itself on a computer system,
|
||||||
|
the memory of the computer is modified dynamically or semi-dynamically.
|
||||||
|
\"Software\", secondly, processes or interprets information.
|
||||||
|
|
||||||
|
Source Code is Any digital Work which, through use of a third-party
|
||||||
|
piece of Software or through the direct usage of itself on a computer
|
||||||
|
system, the memory of the computer is modified dynamically or
|
||||||
|
semi-dynamically. \"Software\", secondly, processes or interprets
|
||||||
|
information.
|
||||||
|
|
||||||
|
Surveilling is the use of the Work to either overtly or covertly observe
|
||||||
|
and record persons and or their activities.
|
||||||
|
|
||||||
|
A Network Service is the use of a piece of Software to interpret or
|
||||||
|
modify information that is subsequently and directly served to users
|
||||||
|
over the Internet.
|
||||||
|
|
||||||
|
To Discriminate is the use of a piece of Software to interpret or modify
|
||||||
|
information that is subsequently and directly served to users over the
|
||||||
|
Internet.
|
||||||
|
|
||||||
|
Hate Speech is Communication or any form of expression which is solely
|
||||||
|
for the purpose of expressing hatred for some group or advocating a form
|
||||||
|
of Discrimination between humans.
|
||||||
|
|
||||||
|
Coercion is leveraging of the threat of force or use of force to
|
||||||
|
intimidate a person in order to gain compliance, or to offer large
|
||||||
|
incentives which aim to entice a person to act against their will.
|
||||||
|
|
||||||
|
# Fair Dealing Rights
|
||||||
|
|
||||||
|
Nothing in this License is intended to reduce, limit, or restrict any
|
||||||
|
uses free from copyright or rights arising from limitations or
|
||||||
|
exceptions that are provided for in connection with the copyright
|
||||||
|
protection under copyright law or other applicable laws.
|
||||||
|
|
||||||
|
# License Grant
|
||||||
|
|
||||||
|
Subject to the terms and conditions of this License, Licensor hereby
|
||||||
|
grants You a worldwide, royalty-free, non-exclusive, perpetual (for the
|
||||||
|
duration of the applicable copyright) license to exercise the rights in
|
||||||
|
the Work as stated below:
|
||||||
|
|
||||||
|
To Reproduce the Work, to incorporate the Work into one or more
|
||||||
|
Collections, and to Reproduce the Work as incorporated in the
|
||||||
|
Collections
|
||||||
|
|
||||||
|
To create and Reproduce Adaptations provided that any such Adaptation,
|
||||||
|
including any translation in any medium, takes reasonable steps to
|
||||||
|
clearly label, demarcate or otherwise identify that changes were made to
|
||||||
|
the original Work. For example, a translation could be marked \"The
|
||||||
|
original work was translated from English to Spanish,\" or a
|
||||||
|
modification could indicate \"The original work has been modified.\"
|
||||||
|
|
||||||
|
To Distribute and Publicly Perform the Work including as incorporated in
|
||||||
|
Collections.
|
||||||
|
|
||||||
|
To Distribute and Publicly Perform Adaptations. The above rights may be
|
||||||
|
exercised in all media and formats whether now known or hereafter
|
||||||
|
devised. The above rights include the right to make such modifications
|
||||||
|
as are technically necessary to exercise the rights in other media and
|
||||||
|
formats. This License constitutes the entire agreement between the
|
||||||
|
parties with respect to the Work licensed here. There are no
|
||||||
|
understandings, agreements or representations with respect to the Work
|
||||||
|
not specified here. Licensor shall not be bound by any additional
|
||||||
|
provisions that may appear in any communication from You. This License
|
||||||
|
may not be modified without the mutual written agreement of the Licensor
|
||||||
|
and You. All rights not expressly granted by Licensor are hereby
|
||||||
|
reserved, including but not limited to the rights set forth in
|
||||||
|
Non-waivable Compulsory License Schemes, Waivable Compulsory License
|
||||||
|
Schemes, and Voluntary License Schemes in the restrictions.
|
||||||
|
|
||||||
|
# Restrictions
|
||||||
|
|
||||||
|
The license granted in the license grant above is expressly made subject
|
||||||
|
to and limited by the following restrictions:
|
||||||
|
|
||||||
|
You may Distribute or Publicly Perform the Work only under the terms of
|
||||||
|
this License. You must include a copy of, or the Uniform Resource
|
||||||
|
Identifier (URI) for, this License with every copy of the Work You
|
||||||
|
Distribute or Publicly Perform. You may not offer or impose any terms on
|
||||||
|
the Work that restrict the terms of this License or the ability of the
|
||||||
|
recipient of the Work to exercise the rights granted to that recipient
|
||||||
|
under the terms of the License. You may not sublicense the Work. You
|
||||||
|
must keep intact all notices that refer to this License and to the
|
||||||
|
disclaimer of warranties with every copy of the Work You Distribute or
|
||||||
|
Publicly Perform. When You Distribute or Publicly Perform the Work, You
|
||||||
|
may not impose any effective technological measures on the Work that
|
||||||
|
restrict the ability of a recipient of the Work from You to exercise the
|
||||||
|
rights granted to that recipient under the terms of the License. This
|
||||||
|
Section applies to the Work as incorporated in a Collection, but this
|
||||||
|
does not require the Collection apart from the Work itself to be made
|
||||||
|
subject to the terms of this License. If You create a Collection, upon
|
||||||
|
notice from any Licensor You must, to the extent practicable, remove
|
||||||
|
from the Collection any credit as requested. If You create an
|
||||||
|
Adaptation, upon notice from any Licensor You must, to the extent
|
||||||
|
practicable, remove from the Adaptation any credit as requested.
|
||||||
|
|
||||||
|
If the Work meets the definition of Software, You may exercise the
|
||||||
|
rights granted in the license grant only if You provide a copy of the
|
||||||
|
corresponding Source Code from which the Work was derived in digital
|
||||||
|
form, or You provide a URI for the corresponding Source Code of the
|
||||||
|
Work, to any recipients upon request.
|
||||||
|
|
||||||
|
If the Work is used as or for a Network Service, You may exercise the
|
||||||
|
rights granted in the license grant only if You provide a copy of the
|
||||||
|
corresponding Source Code from which the Work was derived in digital
|
||||||
|
form, or You provide a URI for the corresponding Source Code to the
|
||||||
|
Work, to any recipients of the data served or modified by the Web
|
||||||
|
Service.
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
|
You may exercise the rights granted in the license grant for any
|
||||||
|
purposes only if:
|
||||||
|
|
||||||
|
i. You do not use the Work for the purpose of inflicting Bodily Harm on
|
||||||
|
human beings (subject to criminal prosecution or otherwise) outside
|
||||||
|
of providing medical aid or undergoing a voluntary procedure under
|
||||||
|
no form of Coercion.
|
||||||
|
|
||||||
|
ii. You do not use the Work for the purpose of Surveilling or tracking
|
||||||
|
individuals for financial gain.
|
||||||
|
|
||||||
|
iii. You do not use the Work in an Act of War.
|
||||||
|
|
||||||
|
iv. You do not use the Work for the purpose of supporting or profiting
|
||||||
|
from an Act of War.
|
||||||
|
|
||||||
|
v. You do not use the Work for the purpose of Incarceration.
|
||||||
|
|
||||||
|
vi. You do not use the Work for the purpose of extracting, processing,
|
||||||
|
or refining, oil, gas, or coal. Or to in any other way to
|
||||||
|
deliberately pollute the environment as a byproduct of manufacturing
|
||||||
|
or irresponsible disposal of hazardous materials.
|
||||||
|
|
||||||
|
vii. You do not use the Work for the purpose of expediting,
|
||||||
|
coordinating, or facilitating paid work undertaken by individuals
|
||||||
|
under the age of 12 years.
|
||||||
|
|
||||||
|
viii. You do not use the Work to either Discriminate or spread Hate
|
||||||
|
Speech on the basis of sex, sexual orientation, gender identity,
|
||||||
|
race, age, disability, color, national origin, religion, caste, or
|
||||||
|
lower economic status.
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
|
If You Distribute, or Publicly Perform the Work or any Adaptations or
|
||||||
|
Collections, You must, unless a request has been made by any Licensor to
|
||||||
|
remove credit from a Collection or Adaptation, keep intact all copyright
|
||||||
|
notices for the Work and provide, reasonable to the medium or means You
|
||||||
|
are utilizing:
|
||||||
|
|
||||||
|
i. the name of the Original Author (or pseudonym, if applicable) if
|
||||||
|
supplied, and/or if the Original Author and/or Licensor designate
|
||||||
|
another party or parties (e.g., a sponsor institute, publishing
|
||||||
|
entity, journal) for attribution (\"Attribution Parties\") in
|
||||||
|
Licensor\'s copyright notice, terms of service or by other
|
||||||
|
reasonable means, the name of such party or parties;
|
||||||
|
|
||||||
|
ii. the title of the Work if supplied;
|
||||||
|
|
||||||
|
iii. to the extent reasonably practicable, the URI, if any, that
|
||||||
|
Licensor to be associated with the Work, unless such URI does not
|
||||||
|
refer to the copyright notice or licensing information for the
|
||||||
|
Work; and,
|
||||||
|
|
||||||
|
iv. in the case of an Adaptation, a credit identifying the use of the
|
||||||
|
Work in the Adaptation (e.g., \"French translation of the Work by
|
||||||
|
Original Author,\" or \"Screenplay based on original Work by
|
||||||
|
Original Author\").
|
||||||
|
|
||||||
|
If any Licensor has sent notice to request removing credit, You must, to
|
||||||
|
the extent practicable, remove any credit as requested. The credit
|
||||||
|
required by this Section may be implemented in any reasonable manner;
|
||||||
|
provided, however, that in the case of an Adaptation or Collection, at a
|
||||||
|
minimum such credit will appear, if a credit for all contributing
|
||||||
|
authors of the Adaptation or Collection appears, then as part of these
|
||||||
|
credits and in a manner at least as prominent as the credits for the
|
||||||
|
other contributing authors. For the avoidance of doubt, You may only use
|
||||||
|
the credit required by this Section for the purpose of attribution in
|
||||||
|
the manner set out above and, by exercising Your rights under this
|
||||||
|
License, You may not implicitly or explicitly assert or imply any
|
||||||
|
connection with, sponsorship or endorsement by the Original Author,
|
||||||
|
Licensor and/or Attribution Parties, as appropriate, of You or Your use
|
||||||
|
of the Work, without the separate, express prior written permission of
|
||||||
|
the Original Author, Licensor and/or Attribution Parties.
|
||||||
|
|
||||||
|
Except as otherwise agreed in writing by the Licensor or as may be
|
||||||
|
otherwise permitted by applicable law, if You Reproduce, Distribute or
|
||||||
|
Publicly Perform the Work either by itself or as part of any Adaptations
|
||||||
|
or Collections, You must not distort, mutilate, modify or take other
|
||||||
|
derogatory action in relation to the Work which would be prejudicial to
|
||||||
|
the Original Author\'s honor or reputation. Licensor agrees that in
|
||||||
|
those jurisdictions (e.g. Japan), in which any exercise of the right
|
||||||
|
granted in the license grant of this License (the right to make
|
||||||
|
Adaptations) would be deemed to be a distortion, mutilation,
|
||||||
|
modification or other derogatory action prejudicial to the Original
|
||||||
|
Author\'s honor and reputation, the Licensor will waive or not assert,
|
||||||
|
as appropriate, this Section, to the fullest extent permitted by the
|
||||||
|
applicable national law, to enable You to reasonably exercise Your right
|
||||||
|
under the license grant of this License (right to make Adaptations) but
|
||||||
|
not otherwise.
|
||||||
|
|
||||||
|
Do not make any legal claim against anyone accusing the Work, with or
|
||||||
|
without changes, alone or with other works, of infringing any patent
|
||||||
|
claim.
|
||||||
|
|
||||||
|
# Representations Warranties and Disclaimer
|
||||||
|
|
||||||
|
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR
|
||||||
|
OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
|
||||||
|
KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE,
|
||||||
|
INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF
|
||||||
|
LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS,
|
||||||
|
WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE
|
||||||
|
EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
|
||||||
|
|
||||||
|
# Limitation on Liability
|
||||||
|
|
||||||
|
EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL
|
||||||
|
LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL,
|
||||||
|
INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF
|
||||||
|
THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED
|
||||||
|
OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
# Termination
|
||||||
|
|
||||||
|
This License and the rights granted hereunder will terminate
|
||||||
|
automatically upon any breach by You of the terms of this License.
|
||||||
|
Individuals or entities who have received Adaptations or Collections
|
||||||
|
from You under this License, however, will not have their licenses
|
||||||
|
terminated provided such individuals or entities remain in full
|
||||||
|
compliance with those licenses. The Sections on definitions, fair
|
||||||
|
dealing rights, representations, warranties, and disclaimer, limitation
|
||||||
|
on liability, termination, and revised license versions will survive any
|
||||||
|
termination of this License.
|
||||||
|
|
||||||
|
Subject to the above terms and conditions, the license granted here is
|
||||||
|
perpetual (for the duration of the applicable copyright in the Work).
|
||||||
|
Notwithstanding the above, Licensor reserves the right to release the
|
||||||
|
Work under different license terms or to stop distributing the Work at
|
||||||
|
any time; provided, however that any such election will not serve to
|
||||||
|
withdraw this License (or any other license that has been, or is
|
||||||
|
required to be, granted under the terms of this License), and this
|
||||||
|
License will continue in full force and effect unless terminated as
|
||||||
|
stated above.
|
||||||
|
|
||||||
|
# Revised License Versions
|
||||||
|
|
||||||
|
This License may receive future revisions in the original spirit of the
|
||||||
|
license intended to strengthen This License. Each version of This
|
||||||
|
License has an incrementing version number.
|
||||||
|
|
||||||
|
Unless otherwise specified like in the below subsection The Licensor has
|
||||||
|
only granted this current version of This License for The Work. In this
|
||||||
|
case future revisions do not apply.
|
||||||
|
|
||||||
|
The Licensor may specify that the latest available revision of This
|
||||||
|
License be used for The Work by either explicitly writing so or by
|
||||||
|
suffixing the License URI with a \"+\" symbol.
|
||||||
|
|
||||||
|
The Licensor may specify that The Work is also available under the terms
|
||||||
|
of This License\'s current revision as well as specific future
|
||||||
|
revisions. The Licensor may do this by writing it explicitly or
|
||||||
|
suffixing the License URI with any additional version numbers each
|
||||||
|
separated by a comma.
|
||||||
|
|
||||||
|
# Miscellaneous
|
||||||
|
|
||||||
|
Each time You Distribute or Publicly Perform the Work or a Collection,
|
||||||
|
the Licensor offers to the recipient a license to the Work on the same
|
||||||
|
terms and conditions as the license granted to You under this License.
|
||||||
|
|
||||||
|
Each time You Distribute or Publicly Perform an Adaptation, Licensor
|
||||||
|
offers to the recipient a license to the original Work on the same terms
|
||||||
|
and conditions as the license granted to You under this License.
|
||||||
|
|
||||||
|
If the Work is classified as Software, each time You Distribute or
|
||||||
|
Publicly Perform an Adaptation, Licensor offers to the recipient a copy
|
||||||
|
and/or URI of the corresponding Source Code on the same terms and
|
||||||
|
conditions as the license granted to You under this License.
|
||||||
|
|
||||||
|
If the Work is used as a Network Service, each time You Distribute or
|
||||||
|
Publicly Perform an Adaptation, or serve data derived from the Software,
|
||||||
|
the Licensor offers to any recipients of the data a copy and/or URI of
|
||||||
|
the corresponding Source Code on the same terms and conditions as the
|
||||||
|
license granted to You under this License.
|
||||||
|
|
||||||
|
If any provision of this License is invalid or unenforceable under
|
||||||
|
applicable law, it shall not affect the validity or enforceability of
|
||||||
|
the remainder of the terms of this License, and without further action
|
||||||
|
by the parties to this agreement, such provision shall be reformed to
|
||||||
|
the minimum extent necessary to make such provision valid and
|
||||||
|
enforceable.
|
||||||
|
|
||||||
|
No term or provision of this License shall be deemed waived and no
|
||||||
|
breach consented to unless such waiver or consent shall be in writing
|
||||||
|
and signed by the party to be charged with such waiver or consent.
|
||||||
|
|
||||||
|
This License constitutes the entire agreement between the parties with
|
||||||
|
respect to the Work licensed here. There are no understandings,
|
||||||
|
agreements or representations with respect to the Work not specified
|
||||||
|
here. Licensor shall not be bound by any additional provisions that may
|
||||||
|
appear in any communication from You. This License may not be modified
|
||||||
|
without the mutual written agreement of the Licensor and You.
|
||||||
|
|
||||||
|
The rights granted under, and the subject matter referenced, in this
|
||||||
|
License were drafted utilizing the terminology of the Berne Convention
|
||||||
|
for the Protection of Literary and Artistic Works (as amended on
|
||||||
|
September 28, 1979), the Rome Convention of 1961, the WIPO Copyright
|
||||||
|
Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and
|
||||||
|
the Universal Copyright Convention (as revised on July 24, 1971). These
|
||||||
|
rights and subject matter take effect in the relevant jurisdiction in
|
||||||
|
which the License terms are sought to be enforced according to the
|
||||||
|
corresponding provisions of the implementation of those treaty
|
||||||
|
provisions in the applicable national law. If the standard suite of
|
||||||
|
rights granted under applicable copyright law includes additional rights
|
||||||
|
not granted under this License, such additional rights are deemed to be
|
||||||
|
included in the License; this License is not intended to restrict the
|
||||||
|
license of any rights under applicable law.
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Techia
|
||||||
|
|
||||||
|
this mod contains a bunch of random stuff, mainly tech related, whatever that means
|
||||||
|
|
||||||
|
currently developing for 1.17.1 (see [issue #1](https://git.lain.faith/ella/techia/issues/1))
|
||||||
|
|
||||||
|
**this is a fabric mod and i don't think i'll ever get around to porting it to forge**, especially because i generally don't play forge
|
||||||
|
|
||||||
|
## where's the info?
|
||||||
|
|
||||||
|
coming to a techia near you soon(TM)
|
|
@ -0,0 +1,79 @@
|
||||||
|
plugins {
|
||||||
|
id 'fabric-loom' version '0.9-SNAPSHOT'
|
||||||
|
// not planning to publish to maven
|
||||||
|
// id 'maven-publish'
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_16
|
||||||
|
targetCompatibility = JavaVersion.VERSION_16
|
||||||
|
|
||||||
|
archivesBaseName = project.archives_base_name
|
||||||
|
version = project.mod_version
|
||||||
|
group = project.maven_group
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||||
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||||
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
|
|
||||||
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
inputs.property "version", project.version
|
||||||
|
inputs.property "id", project.archives_base_name
|
||||||
|
inputs.property "name", project.mod_name
|
||||||
|
|
||||||
|
filesMatching("fabric.mod.json") {
|
||||||
|
expand "version": project.version
|
||||||
|
expand "id": project.archives_base_name
|
||||||
|
expand "name": project.mod_name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile).configureEach {
|
||||||
|
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||||
|
// this fixes some edge cases with special characters not displaying correctly
|
||||||
|
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||||
|
// If Javadoc is generated, this must be specified in that task too.
|
||||||
|
it.options.encoding = "UTF-8"
|
||||||
|
|
||||||
|
it.options.release = 16
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||||
|
// if it is present.
|
||||||
|
// If you remove this line, sources will not be generated.
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
from("LICENSE") {
|
||||||
|
rename { "${it}_${project.archivesBaseName}"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// configure the maven publication
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
mavenJava(MavenPublication) {
|
||||||
|
// add all the jars that should be included when publishing to maven
|
||||||
|
artifact(remapJar) {
|
||||||
|
builtBy remapJar
|
||||||
|
}
|
||||||
|
artifact(sourcesJar) {
|
||||||
|
builtBy remapSourcesJar
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
||||||
|
repositories {
|
||||||
|
// Add repositories to publish to here.
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Done to increase the memory available to gradle.
|
||||||
|
org.gradle.jvmargs=-Xmx1G
|
||||||
|
|
||||||
|
# Fabric Properties
|
||||||
|
# check these on https://fabricmc.net/versions.html
|
||||||
|
minecraft_version=1.17.1
|
||||||
|
yarn_mappings=1.17.1+build.39
|
||||||
|
loader_version=0.11.6
|
||||||
|
|
||||||
|
# Mod Properties
|
||||||
|
mod_version=0.0.1
|
||||||
|
maven_group=ella
|
||||||
|
archives_base_name=techia
|
||||||
|
mod_name=Techia
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
fabric_version=0.39.2+1.17
|
Binary file not shown.
|
@ -0,0 +1,5 @@
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
|
@ -0,0 +1,185 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# 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\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# 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
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MSYS* | MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
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" -a "$nonstop" = "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 or MSYS, switch paths to Windows format before running java
|
||||||
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=`expr $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
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
|
@ -0,0 +1,89 @@
|
||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@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
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@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 execute
|
||||||
|
|
||||||
|
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 execute
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
: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 %*
|
||||||
|
|
||||||
|
: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,0 +1,26 @@
|
||||||
|
package ella.techia;
|
||||||
|
|
||||||
|
import ella.techia.registry.TechiaRegistry;
|
||||||
|
import net.fabricmc.api.ModInitializer;
|
||||||
|
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.collection.DefaultedList;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
|
public class Techia implements ModInitializer {
|
||||||
|
|
||||||
|
public static final String MOD_ID = "techia";
|
||||||
|
//public static Map<Identifier, JsonObject> recipes = new Map<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInitialize(){
|
||||||
|
TechiaRegistry.register();
|
||||||
|
|
||||||
|
FabricItemGroupBuilder.create(new Identifier(MOD_ID, "items")).icon(() -> TechiaBlocks.LETIUM.asItem().getDefaultStack()).appendItems(stacks -> Registry.ITEM.forEach(item -> {
|
||||||
|
if(Registry.ITEM.getId(item).getNamespace().equals(MOD_ID)){
|
||||||
|
item.appendStacks(item.getGroup(), (DefaultedList<ItemStack>) stacks);
|
||||||
|
}
|
||||||
|
})).build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package ella.techia;
|
||||||
|
|
||||||
|
import ella.techia.screen.*;
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public class TechiaClient implements ClientModInitializer {
|
||||||
|
@Override
|
||||||
|
public void onInitializeClient() {
|
||||||
|
ScreenRegistry.register(Techia.BOX_SCREEN_HANDLER, BoxScreen::new);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package ella.techia.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class BoxBlock extends ToolBlock implements BlockEntityProvider {
|
||||||
|
protected BoxBlock(Settings settings){
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockEntity createBlockEntity(BlockPos pos, BlockState state){
|
||||||
|
return new BoxBlockEntity(pos, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved){
|
||||||
|
if(state.getBlock() != newState.getBlock()){
|
||||||
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||||
|
if(blockEntity instanceof BoxBlockEntity){
|
||||||
|
ItemScatterer.spawn(world, pos, (BoxBlockEntity)blockEntity);
|
||||||
|
}
|
||||||
|
super.onStateReplaced(state, world, pos, newState, moved);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack){
|
||||||
|
if(itemStack.hasCustomName()){
|
||||||
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||||
|
if(blockEntity instanceof BoxBlockEntity)
|
||||||
|
((BoxBlockEntity)blockEntity).setCustomName(itemStack.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,137 @@
|
||||||
|
package ella.ellas_mod.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.block.enums.DoubleBlockHalf;
|
||||||
|
import net.minecraft.entity.ai.pathing.NavigationType;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.fluid.FluidState;
|
||||||
|
import net.minecraft.fluid.Fluids;
|
||||||
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
|
import net.minecraft.sound.SoundCategory;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
import net.minecraft.state.StateManager;
|
||||||
|
import net.minecraft.state.property.BooleanProperty;
|
||||||
|
import net.minecraft.state.property.DirectionProperty;
|
||||||
|
import net.minecraft.state.property.Properties;
|
||||||
|
import net.minecraft.util.ActionResult;
|
||||||
|
import net.minecraft.util.DyeColor;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
|
import net.minecraft.util.shape.VoxelShapes;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldAccess;
|
||||||
|
import net.minecraft.world.WorldView;
|
||||||
|
|
||||||
|
public class CageBlock extends Block /*implements Waterloggable*/ {
|
||||||
|
|
||||||
|
public CageBlock(net.minecraft.block.AbstractBlock.Settings settings){
|
||||||
|
super(settings);
|
||||||
|
//FabricBlockSettings.copyOf(Blocks.END_ROD);
|
||||||
|
/*setDefaultState(getDefaultState()
|
||||||
|
.with(Properties.FACING, Direction.UP)
|
||||||
|
.with(LIT, true)
|
||||||
|
.with(Properties.WATERLOGGED, false));*/
|
||||||
|
this.setDefaultState(this.stateManager.getDefaultState().with(Properties.DOUBLE_BLOCK_HALF, DoubleBlockHalf.LOWER));
|
||||||
|
}
|
||||||
|
|
||||||
|
//getShapeForState
|
||||||
|
@Override
|
||||||
|
protected void appendProperties(StateManager.Builder<Block, BlockState> builder){
|
||||||
|
super.appendProperties(builder);
|
||||||
|
builder.add(Properties.DOUBLE_BLOCK_HALF);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context){
|
||||||
|
switch((DoubleBlockHalf)state.get(Properties.DOUBLE_BLOCK_HALF)){
|
||||||
|
case UPPER:
|
||||||
|
return VoxelShapes.union(
|
||||||
|
createCuboidShape( 0.0, 0.0, 0.0, 1.0, 16.0, 16.0),
|
||||||
|
createCuboidShape(15.0, 0.0, 0.0, 16.0, 16.0, 16.0),
|
||||||
|
createCuboidShape( 1.0, 0.0, 0.0, 15.0, 16.0, 1.0),
|
||||||
|
createCuboidShape( 1.0, 0.0, 15.0, 15.0, 16.0, 16.0),
|
||||||
|
createCuboidShape( 1.0, 15.0, 1.0, 15.0, 16.0, 15.0)
|
||||||
|
);
|
||||||
|
case LOWER:
|
||||||
|
default:
|
||||||
|
return VoxelShapes.union(
|
||||||
|
createCuboidShape( 0.0, 0.0, 0.0, 1.0, 16.0, 16.0),
|
||||||
|
createCuboidShape(15.0, 0.0, 0.0, 16.0, 16.0, 16.0),
|
||||||
|
createCuboidShape( 1.0, 0.0, 0.0, 15.0, 16.0, 1.0),
|
||||||
|
createCuboidShape( 1.0, 0.0, 15.0, 15.0, 16.0, 16.0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getPlacementState(ItemPlacementContext context){
|
||||||
|
return super.getPlacementState(context)
|
||||||
|
//.with(Properties.WATERLOGGED, context.getWorld().getFluidState(context.getBlockPos()).getFluid() == Fluids.WATER)
|
||||||
|
.with(Properties.DOUBLE_BLOCK_HALF, DoubleBlockHalf.LOWER);
|
||||||
|
// TODO FIXME placement state, place upper half somehow??
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos){
|
||||||
|
BlockPos belowPos = pos.down();
|
||||||
|
if(state.get(Properties.DOUBLE_BLOCK_HALF) == DoubleBlockHalf.UPPER){
|
||||||
|
return world.getBlockState(belowPos).isOf(EllasModBlocks.CAGE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return world.getBlockState(belowPos).isSideSolidFullSquare(world, belowPos, Direction.UP);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) {
|
||||||
|
world.setBlockState(pos.up(), this.getDefaultState().with(Properties.DOUBLE_BLOCK_HALF, DoubleBlockHalf.UPPER));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onBreak(WorldAccess world, BlockPos pos, BlockState state, PlayerEntity player){
|
||||||
|
BlockPos other = state.get(Properties.DOUBLE_BLOCK_HALF) == DoubleBlockHalf.UPPER?
|
||||||
|
pos.down() : pos.up();
|
||||||
|
if(world.getBlockState(other).isOf(EllasModBlocks.CAGE))
|
||||||
|
//world.setBlockState(other, Blocks.AIR.getDefaultState())
|
||||||
|
world.breakBlock(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*onBreakInCreative(bwq, gg, BlockState state, bke){
|
||||||
|
clp var4 = (clp)state.c(a);
|
||||||
|
if (var4 == clp.a) {
|
||||||
|
gg var5 = var1.c();
|
||||||
|
ckt var6 = var0.a_(var5);
|
||||||
|
if (var6.a(state.b()) && var6.c(a) == clp.b) {
|
||||||
|
ckt var7 = var6.b(clj.C) && ((Boolean)var6.c(clj.C)).booleanValue() ? bzq.A.n() : bzq.a.n();
|
||||||
|
var0.a(var5, var7, 35);
|
||||||
|
var0.a(var3, 2001, var5, bzp.i(var6));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
/*@Override
|
||||||
|
public FluidState getFluidState(BlockState state){
|
||||||
|
if(state.get(Properties.WATERLOGGED)) return Fluids.WATER.getStill(false);
|
||||||
|
else return super.getFluidState(state);
|
||||||
|
}*/
|
||||||
|
@Override
|
||||||
|
public BlockState getStateForNeighborUpdate(
|
||||||
|
BlockState state,
|
||||||
|
Direction side,
|
||||||
|
BlockState neighborState,
|
||||||
|
WorldAccess world,
|
||||||
|
BlockPos pos,
|
||||||
|
BlockPos neighborPos
|
||||||
|
){
|
||||||
|
if(state.canPlaceAt(world, pos))
|
||||||
|
return state;
|
||||||
|
return Blocks.AIR.getDefaultState();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,138 @@
|
||||||
|
package ella.techia.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.entity.ai.pathing.NavigationType;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.fluid.FluidState;
|
||||||
|
import net.minecraft.fluid.Fluids;
|
||||||
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
|
import net.minecraft.sound.SoundCategory;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
import net.minecraft.state.StateManager;
|
||||||
|
import net.minecraft.state.property.BooleanProperty;
|
||||||
|
import net.minecraft.state.property.DirectionProperty;
|
||||||
|
import net.minecraft.state.property.Properties;
|
||||||
|
import net.minecraft.util.ActionResult;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldAccess;
|
||||||
|
import net.minecraft.world.WorldView;
|
||||||
|
|
||||||
|
public class Connector extends Block implements LetiBlock, Waterloggable {
|
||||||
|
|
||||||
|
static final VoxelShape BASE_SHAPE = createCuboidShape( 5d, 5d, 5d, 11d, 11d, 11d);
|
||||||
|
static final VoxelShape NORTH_SHAPE = createCuboidShape( 6d, 6d, 0d, 10d, 10d, 5d);
|
||||||
|
static final VoxelShape SOUTH_SHAPE = createCuboidShape( 6d, 6d, 11d, 10d, 10d, 16d);
|
||||||
|
static final VoxelShape EAST_SHAPE = createCuboidShape(11d, 6d, 6d, 16d, 10d, 10d);
|
||||||
|
static final VoxelShape WEST_SHAPE = createCuboidShape( 0d, 6d, 6d, 5d, 10d, 10d);
|
||||||
|
static final VoxelShape UP_SHAPE = createCuboidShape( 6d, 6d, 6d, 10d, 16d, 10d);
|
||||||
|
static final VoxelShape DOWN_SHAPE = createCuboidShape( 6d, 0d, 6d, 10d, 5d, 10d);
|
||||||
|
|
||||||
|
public EllasModLampBlock(net.minecraft.block.AbstractBlock.Settings settings){
|
||||||
|
super(settings);
|
||||||
|
this.setDefaultState(
|
||||||
|
this.stateManager.getDefaultState()
|
||||||
|
.with(Properties.WATERLOGGED, false)
|
||||||
|
.with(Properties.UP , false)
|
||||||
|
.with(Properties.DOWN , false)
|
||||||
|
.with(Properties.NORTH, false)
|
||||||
|
.with(Properties.SOUTH, false)
|
||||||
|
.with(Properties.EAST , false)
|
||||||
|
.with(Properties.WEST , false)
|
||||||
|
.with(Properties.POWERED, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
//getShapeForState
|
||||||
|
@Override
|
||||||
|
protected void appendProperties(StateManager.Builder<Block, BlockState> builder){
|
||||||
|
super.appendProperties(builder);
|
||||||
|
builder.add(Properties.DOWN, Properties.EAST, Properties.FACING, Properties.NORTH, Properties.SOUTH, Properties.WATERLOGGED);
|
||||||
|
}
|
||||||
|
/*@Override
|
||||||
|
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit){
|
||||||
|
return ActionResult.SUCCESS;
|
||||||
|
}*/
|
||||||
|
@Override
|
||||||
|
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context){
|
||||||
|
VoxelShape shape = BASE_SHAPE;
|
||||||
|
if(((Boolean)state.get(Properties.NORTH)).booleanValue()){
|
||||||
|
shape = VoxelShapes.union(shape, NORTH_SHAPE);
|
||||||
|
}
|
||||||
|
if(((Boolean)state.get(Properties.SOUTH)).booleanValue()){
|
||||||
|
shape = VoxelShapes.union(shape, SOUTH_SHAPE);
|
||||||
|
}
|
||||||
|
if(((Boolean)state.get(Properties.EAST)).booleanValue()){
|
||||||
|
shape = VoxelShapes.union(shape, EAST_SHAPE);
|
||||||
|
}
|
||||||
|
if(((Boolean)state.get(Properties.WEST)).booleanValue()){
|
||||||
|
shape = VoxelShapes.union(shape, WEST_SHAPE);
|
||||||
|
}
|
||||||
|
if(((Boolean)state.get(Properties.UP)).booleanValue()){
|
||||||
|
shape = VoxelShapes.union(shape, UP_SHAPE);
|
||||||
|
}
|
||||||
|
if(((Boolean)state.get(Properties.DOWN)).booleanValue()){
|
||||||
|
shape = VoxelShapes.union(shape, DOWN_SHAPE);
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getPlacementState(ItemPlacementContext context){
|
||||||
|
var world = context.getWorld();
|
||||||
|
var pos = context.getBlockPos();
|
||||||
|
return super.getPlacementState(context)
|
||||||
|
.with(Properties.WATERLOGGED, world.getFluidState(pos).getFluid() == Fluids.WATER)
|
||||||
|
.with(Properties.NORTH, connects(world.getBlockState(pos.north()).getBlock()))
|
||||||
|
.with(Properties.SOUTH, connects(world.getBlockState(pos.south()).getBlock()))
|
||||||
|
.with(Properties.EAST , connects(world.getBlockState(pos.east() ).getBlock()))
|
||||||
|
.with(Properties.WEST , connects(world.getBlockState(pos.west() ).getBlock()))
|
||||||
|
.with(Properties.UP , connects(world.getBlockState(pos.up() ).getBlock()))
|
||||||
|
.with(Properties.DOWN , connects(world.getBlockState(pos.down() ).getBlock()))
|
||||||
|
.with(Properties.POWERED, /*powered(world.getBlockState(pos).getBlock())*/false);
|
||||||
|
}
|
||||||
|
public boolean connects(Block block){
|
||||||
|
if(block instanceof LetiBlock)
|
||||||
|
return (LetiBlock)block.connects;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/*@Override
|
||||||
|
public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type){
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
@Override
|
||||||
|
public FluidState getFluidState(BlockState state){
|
||||||
|
if(state.get(Properties.WATERLOGGED)) return Fluids.WATER.getStill(false);
|
||||||
|
else return super.getFluidState(state);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public BlockState getStateForNeighborUpdate(
|
||||||
|
BlockState state,
|
||||||
|
Direction side,
|
||||||
|
BlockState neighborState,
|
||||||
|
WorldAccess world,
|
||||||
|
BlockPos pos,
|
||||||
|
BlockPos neighborPos
|
||||||
|
){
|
||||||
|
// can't be assed to only update one side
|
||||||
|
return state
|
||||||
|
.with(Properties.NORTH, connects(world.getBlockState(pos.north()).getBlock()))
|
||||||
|
.with(Properties.SOUTH, connects(world.getBlockState(pos.south()).getBlock()))
|
||||||
|
.with(Properties.EAST , connects(world.getBlockState(pos.east() ).getBlock()))
|
||||||
|
.with(Properties.WEST , connects(world.getBlockState(pos.west() ).getBlock()))
|
||||||
|
.with(Properties.UP , connects(world.getBlockState(pos.up() ).getBlock()))
|
||||||
|
.with(Properties.DOWN , connects(world.getBlockState(pos.down() ).getBlock()))
|
||||||
|
/*.with(Properties.POWERED, /*powered(world.getBlockState(pos).getBlock())* /false)*/;
|
||||||
|
}
|
||||||
|
/*@Override
|
||||||
|
rotate(BlockState state, BlockRotation rotation): BlockState {
|
||||||
|
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}*/
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
package ella.techia.block;
|
||||||
|
|
||||||
|
public interface LetiBlock {
|
||||||
|
public boolean connects; // TODO maybe a method?
|
||||||
|
public boolean output();
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package ella.techia.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.*;
|
||||||
|
//import net.minecraft.entity.ai.pathing.NavigationType;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.fluid.FluidState;
|
||||||
|
import net.minecraft.fluid.Fluids;
|
||||||
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
|
//import net.minecraft.sound.BlockSoundGroup;
|
||||||
|
import net.minecraft.sound.SoundCategory;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
import net.minecraft.state.StateManager;
|
||||||
|
import net.minecraft.state.property.BooleanProperty;
|
||||||
|
import net.minecraft.state.property.Properties;
|
||||||
|
import net.minecraft.util.ActionResult;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldAccess;
|
||||||
|
import net.minecraft.world.WorldView;
|
||||||
|
|
||||||
|
public class Smelter extends BlockWithEntity implements BlockEntityProvider {
|
||||||
|
|
||||||
|
public EllasModLampBlock(net.minecraft.block.AbstractBlock.Settings settings){
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockRenderType getRenderType(BlockState state){
|
||||||
|
return BlockRenderType.MODEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit){
|
||||||
|
if(!world.isClient){
|
||||||
|
//This will call the createScreenHandlerFactory method from BlockWithEntity, which will return our blockEntity casted to
|
||||||
|
//a namedScreenHandlerFactory.
|
||||||
|
NamedScreenHandlerFactory screenHandlerFactory = state.createScreenHandlerFactory(world, pos);
|
||||||
|
|
||||||
|
if(screenHandlerFactory != null){
|
||||||
|
//With this call the server will request the client to open the appropriate Screenhandler
|
||||||
|
player.openHandledScreen(screenHandlerFactory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ActionResult.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockEntity createBlockEntity(BlockPos pos, BlockState state){
|
||||||
|
return new SmelterEntity(pos, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved){
|
||||||
|
if(state.getBlock() != newState.getBlock()){
|
||||||
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||||
|
if(blockEntity instanceof WorkbenchBlockEntity){
|
||||||
|
ItemScatterer.spawn(world, pos, (WorkbenchBlockEntity)blockEntity);
|
||||||
|
}
|
||||||
|
super.onStateReplaced(state, world, pos, newState, moved);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,82 @@
|
||||||
|
package ella.techia.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.*;
|
||||||
|
//import net.minecraft.entity.ai.pathing.NavigationType;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.fluid.FluidState;
|
||||||
|
import net.minecraft.fluid.Fluids;
|
||||||
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
|
//import net.minecraft.sound.BlockSoundGroup;
|
||||||
|
import net.minecraft.sound.SoundCategory;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
import net.minecraft.state.StateManager;
|
||||||
|
import net.minecraft.state.property.BooleanProperty;
|
||||||
|
import net.minecraft.state.property.Properties;
|
||||||
|
import net.minecraft.util.ActionResult;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldAccess;
|
||||||
|
import net.minecraft.world.WorldView;
|
||||||
|
|
||||||
|
public class ToolBlock extends BlockWithEntity implements Waterloggable {
|
||||||
|
|
||||||
|
static final VoxelShape SHAPE = createCuboidShape( 2d, 0d, 2d, 14d, 12d, 14d);
|
||||||
|
|
||||||
|
public EllasModLampBlock(net.minecraft.block.AbstractBlock.Settings settings){
|
||||||
|
super(settings);
|
||||||
|
this.setDefaultState(
|
||||||
|
this.stateManager.getDefaultState()
|
||||||
|
.with(Properties.WATERLOGGED, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockRenderType getRenderType(BlockState state){
|
||||||
|
return BlockRenderType.MODEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void appendProperties(StateManager.Builder<Block, BlockState> builder){
|
||||||
|
super.appendProperties(builder);
|
||||||
|
builder.add(Properties.WATERLOGGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit){
|
||||||
|
if(!world.isClient){
|
||||||
|
//This will call the createScreenHandlerFactory method from BlockWithEntity, which will return our blockEntity casted to
|
||||||
|
//a namedScreenHandlerFactory.
|
||||||
|
NamedScreenHandlerFactory screenHandlerFactory = state.createScreenHandlerFactory(world, pos);
|
||||||
|
|
||||||
|
if(screenHandlerFactory != null){
|
||||||
|
//With this call the server will request the client to open the appropriate Screenhandler
|
||||||
|
player.openHandledScreen(screenHandlerFactory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ActionResult.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context){
|
||||||
|
return SHAPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getPlacementState(ItemPlacementContext context){
|
||||||
|
return super.getPlacementState(context)
|
||||||
|
.with(Properties.WATERLOGGED, context.getWorld().getFluidState(context.getBlockPos()).getFluid() == Fluids.WATER);
|
||||||
|
}
|
||||||
|
/*@Override
|
||||||
|
public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type){
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
@Override
|
||||||
|
public FluidState getFluidState(BlockState state){
|
||||||
|
if(state.get(Properties.WATERLOGGED)) return Fluids.WATER.getStill(false);
|
||||||
|
else return super.getFluidState(state);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package ella.techia.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class WorkbenchBlock extends ToolBlock implements BlockEntityProvider {
|
||||||
|
protected WorkbenchBlock(Settings settings){
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockEntity createBlockEntity(BlockPos pos, BlockState state){
|
||||||
|
return new WorkbenchBlockEntity(pos, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved){
|
||||||
|
if(state.getBlock() != newState.getBlock()){
|
||||||
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||||
|
if(blockEntity instanceof WorkbenchBlockEntity){
|
||||||
|
ItemScatterer.spawn(world, pos, (WorkbenchBlockEntity)blockEntity);
|
||||||
|
}
|
||||||
|
super.onStateReplaced(state, world, pos, newState, moved);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
|
@ -0,0 +1,36 @@
|
||||||
|
package ella.techia.block.entity;
|
||||||
|
|
||||||
|
public class BoxBlockEntity extends BlockEntity implements ImplInventory {
|
||||||
|
private final DefaultedList<ItemStack> inventory = DefaultedList.ofSize(18, ItemStack.EMPTY);
|
||||||
|
|
||||||
|
public BoxBlockEntity(BlockPos pos, BlockState state){
|
||||||
|
super(ExampleMod.BOX_BLOCK_ENTITY, pos, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DefaultedList<ItemStack> getItems(){
|
||||||
|
return inventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player){
|
||||||
|
return new BoxScreenHandler(syncId, playerInventory, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Text getDisplayName(){
|
||||||
|
return new TranslatableText(getCachedState().getBlock().getTranslationKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readNbt(NbtCompound nbt){
|
||||||
|
super.readNbt(nbt);
|
||||||
|
Inventories.readNbt(nbt, inventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NbtCompound writeNbt(NbtCompound nbt){
|
||||||
|
Inventories.writeNbt(nbt, inventory);
|
||||||
|
return super.writeNbt(nbt);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
package ella.techia.block.entity;
|
||||||
|
|
||||||
|
public interface ImplInventory extends Inventory {
|
||||||
|
|
||||||
|
DefaultedList<ItemStack> getItems();
|
||||||
|
|
||||||
|
static ImplementedInventory of(DefaultedList<ItemStack> items){
|
||||||
|
return () -> items;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ImplementedInventory ofSize(int size){
|
||||||
|
return of(DefaultedList.ofSize(size, ItemStack.EMPTY));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default int size(){
|
||||||
|
return getItems().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default boolean isEmpty(){
|
||||||
|
for(int i = 0; i < size(); i++){
|
||||||
|
ItemStack stack = getStack(i);
|
||||||
|
if(!stack.isEmpty()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default ItemStack getStack(int slot){
|
||||||
|
return getItems().get(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default ItemStack removeStack(int slot, int count){
|
||||||
|
ItemStack result = Inventories.splitStack(getItems(), slot, count);
|
||||||
|
if(!result.isEmpty()){
|
||||||
|
markDirty();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default ItemStack removeStack(int slot){
|
||||||
|
return Inventories.removeStack(getItems(), slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default void setStack(int slot, ItemStack stack){
|
||||||
|
getItems().set(slot, stack);
|
||||||
|
if(stack.getCount() > getMaxCountPerStack()){
|
||||||
|
stack.setCount(getMaxCountPerStack());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default void clear(){
|
||||||
|
getItems().clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Must be called after changes in the inventory, so that the game can properly save
|
||||||
|
* the inventory contents and notify neighboring blocks of inventory changes.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
default void markDirty(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the player can use the inventory, false otherwise.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
default boolean canPlayerUse(PlayerEntity player){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package ella.techia.block.entity;
|
||||||
|
|
||||||
|
public class WorkbenchBlockEntity extends BlockEntity implements ImplInventory {
|
||||||
|
private final DefaultedList<ItemStack> inventory = DefaultedList.ofSize(15, ItemStack.EMPTY);
|
||||||
|
|
||||||
|
public WorkbenchBlockEntity(BlockPos pos, BlockState state){
|
||||||
|
super(ExampleMod.WORKBENCH_BLOCK_ENTITY, pos, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DefaultedList<ItemStack> getItems(){
|
||||||
|
return inventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player){
|
||||||
|
return new WorkbenchScreenHandler(syncId, playerInventory, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Text getDisplayName(){
|
||||||
|
return new TranslatableText(getCachedState().getBlock().getTranslationKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readNbt(NbtCompound nbt){
|
||||||
|
super.readNbt(nbt);
|
||||||
|
Inventories.readNbt(nbt, inventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NbtCompound writeNbt(NbtCompound nbt){
|
||||||
|
Inventories.writeNbt(nbt, inventory);
|
||||||
|
return super.writeNbt(nbt);
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
|
@ -0,0 +1,164 @@
|
||||||
|
package ella.techia.registry;
|
||||||
|
|
||||||
|
import ella.techia.Techia;
|
||||||
|
import ella.techia.block.*;
|
||||||
|
//import net.fabricmc.api.FabricLoader;
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
|
||||||
|
import net.fabricmc.fabric.api.registry.FuelRegistry;
|
||||||
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemGroup;
|
||||||
|
import net.minecraft.item.SignItem;
|
||||||
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
|
import net.minecraft.state.property.Properties;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class TechiaRegistry {
|
||||||
|
/*private static final LinkedHashMap<String, Block> BLOCKS = new LinkedHashMap<>();
|
||||||
|
private static final LinkedHashMap<String, BlockItem> ITEMS = new LinkedHashMap<>();*/
|
||||||
|
|
||||||
|
public static final Block ASMITE_BLOCK = add("asmite_block",
|
||||||
|
new Block(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK)), ItemGroup.BUILDING_BLOCKS);
|
||||||
|
public static final Item ASMITE_INGOT = addI("asmite_ingot", new Item(new Item.Settings().group(ItemGroup.MISC)));
|
||||||
|
public static final Item LETIUM = addI("letium", new Item(new Item.Settings().group(ItemGroup.MISC)));
|
||||||
|
public static final Block CONNECTOR = add("connector", new Connector(FabricBlockSettings.copyOf(Blocks.IRON_BARS).hardness(0.1f).resistance(0f)), ItemGroup.MISC);
|
||||||
|
public static final Block INTERSECTOR = add("intersector", new Intersector(FabricBlockSettings.copyOf(Blocks.IRON_BARS).hardness(0.1f).resistance(0f)), ItemGroup.MISC);
|
||||||
|
public static final Block INVERTER = add("inverter", new Inverter(FabricBlockSettings.copyOf(Blocks.IRON_BARS).hardness(0.1f).resistance(0f)), ItemGroup.MISC);
|
||||||
|
public static final Block DELAYER = add("delayer", new Delayer(FabricBlockSettings.copyOf(Blocks.IRON_BARS).hardness(0.1f).resistance(0f)), ItemGroup.MISC);
|
||||||
|
|
||||||
|
public static final Item BLOCK_SHAPE = addI("block_shape", new Item(new Item.Settings().group(ItemGroup.MISC)));
|
||||||
|
public static final Item INGOT_SHAPE = addI("ingot_shape", new Item(new Item.Settings().group(ItemGroup.MISC)));
|
||||||
|
|
||||||
|
/*public static final Block NONBINARY_BLOCK = add("nonbinary_block",
|
||||||
|
new EFacingBlock(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).mapColor(MapColor.WHITE)), ItemGroup.BUILDING_BLOCKS);
|
||||||
|
|
||||||
|
/*public static final Block SPARKWOOD_LADDER = add("sparkwood_ladder",
|
||||||
|
new SparkwoodLadderBlock(FabricBlockSettings.copyOf(Blocks.LADDER)), ItemGroup.DECORATIONS);*/
|
||||||
|
/*public static final Block SPARKWOOD_FENCE = add("sparkwood_fence",
|
||||||
|
new FenceBlock(FabricBlockSettings.copyOf(Blocks.OAK_FENCE)), ItemGroup.DECORATIONS);*/
|
||||||
|
/*private static final Identifier SPARKWOOD_SIGN_TEXTURE = new Identifier(Techia.MOD_ID, "entity/signs/sparkwood");
|
||||||
|
public static final TerraformSignBlock SPARKWOOD_SIGN = add("sparkwood_sign",
|
||||||
|
new TerraformSignBlock(SPARKWOOD_SIGN_TEXTURE, FabricBlockSettings.copyOf(Blocks.OAK_SIGN)));
|
||||||
|
public static final Block SPARKWOOD_WALL_SIGN = add("sparkwood_wall_sign",
|
||||||
|
new TerraformWallSignBlock(SPARKWOOD_SIGN_TEXTURE, FabricBlockSettings.copyOf(Blocks.OAK_WALL_SIGN)));
|
||||||
|
public static final Item SPARKWOOD_SIGN_ITEM = add("sparkwood_sign",
|
||||||
|
new SignItem(new Item.Settings().maxCount(16).group(ItemGroup.DECORATIONS), SPARKWOOD_SIGN, SPARKWOOD_WALL_SIGN));* /
|
||||||
|
|
||||||
|
public static final Block STONE_BRICK_TILES = add("stone_brick_tiles",
|
||||||
|
new Block(FabricBlockSettings.copyOf(Blocks.STONE_BRICKS)), ItemGroup.BUILDING_BLOCKS);
|
||||||
|
|
||||||
|
public static final Block LARGE_OAK_TILE_SLAB = add("large_oak_tile_slab",
|
||||||
|
new SlabBlock(FabricBlockSettings.copyOf(Blocks.OAK_SLAB)), ItemGroup.DECORATIONS);
|
||||||
|
|
||||||
|
public static final Block LARGE_OAK_TILE_STAIRS = add("large_oak_tile_stairs",
|
||||||
|
new TerraformStairsBlock(LARGE_OAK_TILES, FabricBlockSettings.copyOf(Blocks.OAK_STAIRS)), ItemGroup.DECORATIONS);
|
||||||
|
|
||||||
|
public static final Block LAMP_BLOCK = add("lamp_block",
|
||||||
|
new Block(FabricBlockSettings.copyOf(Blocks.REDSTONE_LAMP).nonOpaque().luminance(15)), ItemGroup.DECORATIONS);
|
||||||
|
public static final Block CAGED_GLASS = add("clear_glass",
|
||||||
|
new GlassBlock(FabricBlockSettings.copyOf(Blocks.GLASS)), ItemGroup.BUILDING_BLOCKS);
|
||||||
|
public static final Block LAMP = add("lamp",
|
||||||
|
new TechiaLampBlock(FabricBlockSettings.copyOf(Blocks.END_ROD)
|
||||||
|
.luminance(state -> state.get(Properties.LIT)? 15: 0)
|
||||||
|
.sounds(BlockSoundGroup.LANTERN)
|
||||||
|
), ItemGroup.DECORATIONS);
|
||||||
|
public static final Block SMALL_LAMP = add("small_lamp",
|
||||||
|
new TechiaSmallLampBlock(FabricBlockSettings.copyOf(Blocks.END_ROD)
|
||||||
|
.luminance(state -> state.get(Properties.LIT)? 15: 0)
|
||||||
|
.sounds(BlockSoundGroup.LANTERN)
|
||||||
|
), ItemGroup.DECORATIONS);
|
||||||
|
public static final Block CAGE = add("cage",
|
||||||
|
new CageBlock(FabricBlockSettings.copyOf(Blocks.IRON_BARS)
|
||||||
|
//.luminance(state -> state.get(Properties.LIT)? 15: 0)
|
||||||
|
//.suffocates(TechiaBlocks::never)
|
||||||
|
//.blockVision(TechiaBlocks::never)
|
||||||
|
), ItemGroup.DECORATIONS);
|
||||||
|
|
||||||
|
/*public static final Block _PLATFORM = add("_platform",
|
||||||
|
new PlatformBlock(FabricBlockSettings.copyOf(Blocks.COBBLESTONE)), ItemGroup.BUILDING_BLOCKS);
|
||||||
|
|
||||||
|
public static final Block OAK_WALL_FENCE = add("oak_wall_fence",
|
||||||
|
new WallFenceBlock(FabricBlockSettings.copyOf(Blocks.OAK_FENCE)), ItemGroup.DECORATIONS);
|
||||||
|
|
||||||
|
public static final Block WINDOWED_IRON_DOOR = add("windowed_iron_door",
|
||||||
|
new TerraformDoorBlock(FabricBlockSettings.copyOf(Blocks.IRON_DOOR)), ItemGroup.REDSTONE);
|
||||||
|
public static final Block YELLOW_BRICK_STAIRS = add("yellow_brick_stairs",
|
||||||
|
new TerraformStairsBlock(YELLOW_BRICKS, FabricBlockSettings.copyOf(Blocks.BRICKS).mapColor(MapColor.PALE_YELLOW)), ItemGroup.BUILDING_BLOCKS);
|
||||||
|
public static final Block YELLOW_BRICK_SLAB = add("yellow_brick_slab",
|
||||||
|
new SlabBlock(FabricBlockSettings.copyOf(Blocks.BRICKS).mapColor(MapColor.PALE_YELLOW)), ItemGroup.BUILDING_BLOCKS);
|
||||||
|
public static final Block YELLOW_BRICK_WALL = add("yellow_brick_wall",
|
||||||
|
new EWallBlock(FabricBlockSettings.copyOf(Blocks.BRICKS).mapColor(MapColor.PALE_YELLOW)), ItemGroup.BUILDING_BLOCKS);*/
|
||||||
|
|
||||||
|
private static <B extends Block> B add(String name, B block, ItemGroup tab){
|
||||||
|
return add(name, block, new BlockItem(block, new Item.Settings().group(tab)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <B extends Block> B add(String name, B block, BlockItem item){
|
||||||
|
add(name, block);
|
||||||
|
if (item != null) {
|
||||||
|
item.appendBlocks(Item.BLOCK_ITEMS, item);
|
||||||
|
//ITEMS.put(name, item);
|
||||||
|
ComposterRecipes.registerCompostableBlock(block);
|
||||||
|
}
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <B extends Block> B add(String name, B block){
|
||||||
|
//BLOCKS.put(name, block);
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <I extends BlockItem> I add(String name, I item){
|
||||||
|
item.appendBlocks(Item.BLOCK_ITEMS, item);
|
||||||
|
//ITEMS.put(name, item);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
private static <I extends Item> I addI(String name, I item){
|
||||||
|
//ITEMS.put(name, item);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void register(){
|
||||||
|
/*if(FabricLoader.getInstance().isModLoaded("")){
|
||||||
|
|
||||||
|
}*/
|
||||||
|
/*for(String id : ITEMS.keySet()){
|
||||||
|
Registry.register(Registry.ITEM, new Identifier(Techia.MOD_ID, id), ITEMS.get(id));
|
||||||
|
}
|
||||||
|
for(String id : BLOCKS.keySet()){
|
||||||
|
Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, id), BLOCKS.get(id));
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//FuelRegistry fuelRegistry = FuelRegistry.INSTANCE;
|
||||||
|
//fuelRegistry.add(, ticks);
|
||||||
|
|
||||||
|
//FlammableBlockRegistry flammableRegistry = FlammableBlockRegistry.getDefaultInstance();
|
||||||
|
|
||||||
|
// could be bad? maybe don't use hash maps?
|
||||||
|
//BLOCKS = null;
|
||||||
|
//ITEMS = null;
|
||||||
|
|
||||||
|
Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, "asmite_block"), ASMITE_BLOCK);
|
||||||
|
Registry.register(Registry.ITEM, new Identifier(Techia.MOD_ID, "asmite_ingot"), ASMITE_INGOT);
|
||||||
|
Registry.register(Registry.ITEM, new Identifier(Techia.MOD_ID, "letium"), LETIUM);
|
||||||
|
Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, "connector"), CONNECTOR);
|
||||||
|
Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, "intersector"), INTERSECTOR);
|
||||||
|
Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, "inverter"), INVERTER);
|
||||||
|
Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, "delayer"), DELAYER);
|
||||||
|
Registry.register(Registry.ITEM, new Identifier(Techia.MOD_ID, "block_shape"), BLOCK_SHAPE);
|
||||||
|
Registry.register(Registry.ITEM, new Identifier(Techia.MOD_ID, "ingot_shape"), INGOT_SHAPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*public static boolean never(BlockState state, BlockView world, BlockPos pos) {
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package ella.techia.screen;
|
||||||
|
|
||||||
|
public class BoxScreen extends HandledScreen<BoxScreenHandler> {
|
||||||
|
private static final Identifier TEXTURE = new Identifier(Techia.MOD_ID, "textures/gui/box.png");
|
||||||
|
|
||||||
|
public BoxScreen(BoxScreenHandler handler, PlayerInventory inventory, Text title){
|
||||||
|
super(handler, inventory, title);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY){
|
||||||
|
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||||
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||||
|
int x = (width - backgroundWidth) / 2;
|
||||||
|
int y = (height - backgroundHeight) / 2;
|
||||||
|
drawTexture(matrices, x, y, 0, 0, backgroundWidth, backgroundHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta){
|
||||||
|
renderBackground(matrices);
|
||||||
|
super.render(matrices, mouseX, mouseY, delta);
|
||||||
|
drawMouseoverTooltip(matrices, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@Override
|
||||||
|
protected void init(){
|
||||||
|
super.init();
|
||||||
|
// Center the title
|
||||||
|
titleX = (backgroundWidth - textRenderer.getWidth(title)) / 2;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
package ella.techia.screen;
|
||||||
|
|
||||||
|
public class BoxScreenHandler extends ScreenHandler {
|
||||||
|
private final Inventory inventory;
|
||||||
|
|
||||||
|
public BoxScreenHandler(int syncId, PlayerInventory playerInventory){
|
||||||
|
this(syncId, playerInventory, new SimpleInventory(18));
|
||||||
|
}
|
||||||
|
|
||||||
|
public BoxScreenHandler(int syncId, PlayerInventory playerInventory, Inventory inventory){
|
||||||
|
super(ExampleMod.BOX_SCREEN_HANDLER, syncId);
|
||||||
|
checkSize(inventory, 18);
|
||||||
|
this.inventory = inventory;
|
||||||
|
inventory.onOpen(playerInventory.player);
|
||||||
|
|
||||||
|
//The slots exist on both server and client
|
||||||
|
int x, y;
|
||||||
|
//box inventory
|
||||||
|
for(y = 0; y < 2; ++y){
|
||||||
|
for(x = 0; x < 9; ++x){
|
||||||
|
this.addSlot(new Slot(inventory, x + y * 9, 8 + x * 18, 17 + y * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//inventory
|
||||||
|
for(y = 0; y < 3; ++y){
|
||||||
|
for(x = 0; x < 9; ++x){
|
||||||
|
this.addSlot(new Slot(playerInventory, x + y * 9 + 9, 8 + x * 18, 66 + y * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//hotbar
|
||||||
|
for(x = 0; x < 9; ++x){
|
||||||
|
this.addSlot(new Slot(playerInventory, x, 8 + x * 18, 134));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUse(PlayerEntity player){
|
||||||
|
return this.inventory.canPlayerUse(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack transferSlot(PlayerEntity player, int invSlot){
|
||||||
|
ItemStack newStack = ItemStack.EMPTY;
|
||||||
|
Slot slot = this.slots.get(invSlot);
|
||||||
|
if(slot != null && slot.hasStack()){
|
||||||
|
ItemStack originalStack = slot.getStack();
|
||||||
|
newStack = originalStack.copy();
|
||||||
|
if(invSlot < this.inventory.size()){
|
||||||
|
if(!this.insertItem(originalStack, this.inventory.size(), this.slots.size(), true)){
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!this.insertItem(originalStack, 0, this.inventory.size(), false)){
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(originalStack.isEmpty()){
|
||||||
|
slot.setStack(ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
slot.markDirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newStack;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package ella.techia.screen;
|
||||||
|
|
||||||
|
public class WorkbenchScreen extends HandledScreen<WorkbenchScreenHandler> {
|
||||||
|
private static final Identifier TEXTURE = new Identifier(Techia.MOD_ID, "textures/gui/workbench.png");
|
||||||
|
|
||||||
|
public WorkbenchScreen(WorkbenchScreenHandler handler, PlayerInventory inventory, Text title){
|
||||||
|
super(handler, inventory, title);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY){
|
||||||
|
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||||
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||||
|
int x = (width - backgroundWidth) / 2;
|
||||||
|
int y = (height - backgroundHeight) / 2;
|
||||||
|
drawTexture(matrices, x, y, 0, 0, backgroundWidth, backgroundHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta){
|
||||||
|
renderBackground(matrices);
|
||||||
|
super.render(matrices, mouseX, mouseY, delta);
|
||||||
|
drawMouseoverTooltip(matrices, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@Override
|
||||||
|
protected void init(){
|
||||||
|
super.init();
|
||||||
|
// Center the title
|
||||||
|
titleX = (backgroundWidth - textRenderer.getWidth(title)) / 2;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
package ella.techia.screen;
|
||||||
|
|
||||||
|
public class WorkbenchScreenHandler extends ScreenHandler {
|
||||||
|
private final Inventory inventory;
|
||||||
|
|
||||||
|
public WorkbenchScreenHandler(int syncId, PlayerInventory playerInventory){
|
||||||
|
this(syncId, playerInventory, new SimpleInventory(15));
|
||||||
|
}
|
||||||
|
|
||||||
|
public WorkbenchScreenHandler(int syncId, PlayerInventory playerInventory, Inventory inventory){
|
||||||
|
super(ExampleMod.WORKBENCH_SCREEN_HANDLER, syncId);
|
||||||
|
checkSize(inventory, 15);
|
||||||
|
this.inventory = inventory;
|
||||||
|
inventory.onOpen(playerInventory.player);
|
||||||
|
|
||||||
|
int x, y;
|
||||||
|
//workbench inventory
|
||||||
|
for(y = 0; y < 3; ++y){
|
||||||
|
for(x = 0; x < 5; ++x){
|
||||||
|
this.addSlot(new Slot(inventory, x + y * 9, 80 + x * 18, 17 + y * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//inventory
|
||||||
|
for(y = 0; y < 3; ++y){
|
||||||
|
for(x = 0; x < 9; ++x){
|
||||||
|
this.addSlot(new Slot(playerInventory, x + y * 9 + 9, 8 + x * 18, 84 + y * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//hotbar
|
||||||
|
for(x = 0; x < 9; ++x){
|
||||||
|
this.addSlot(new Slot(playerInventory, x, 8 + x * 18, 142));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUse(PlayerEntity player){
|
||||||
|
return this.inventory.canPlayerUse(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack transferSlot(PlayerEntity player, int invSlot){
|
||||||
|
ItemStack newStack = ItemStack.EMPTY;
|
||||||
|
Slot slot = this.slots.get(invSlot);
|
||||||
|
if(slot != null && slot.hasStack()){
|
||||||
|
ItemStack originalStack = slot.getStack();
|
||||||
|
newStack = originalStack.copy();
|
||||||
|
if(invSlot < this.inventory.size()){
|
||||||
|
if(!this.insertItem(originalStack, this.inventory.size(), this.slots.size(), true)){
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!this.insertItem(originalStack, 0, this.inventory.size(), false)){
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(originalStack.isEmpty()){
|
||||||
|
slot.setStack(ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
slot.markDirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newStack;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
{
|
||||||
|
"schemaVersion": 1,
|
||||||
|
"id": "${id}",
|
||||||
|
"version": "${version}",
|
||||||
|
|
||||||
|
"name": "${name}",
|
||||||
|
"description": "some random gay tech mod",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Ella Paws",
|
||||||
|
"contact": {
|
||||||
|
"matrix": "@e:lu.gl",
|
||||||
|
"mastodon": "https://transmom.love/@ella"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"contact": {
|
||||||
|
"homepage": "https://ella.wantscuddl.es/f/techia.html",
|
||||||
|
"sources": "https://git.lain.faith/ella/techia",
|
||||||
|
"issues": "https://git.lain.faith/ella/techia/issues"
|
||||||
|
},
|
||||||
|
|
||||||
|
"license": "NVPL (https://git.pixie.town/thufie/npl-builder/raw/branch/main/nvpl.md)",
|
||||||
|
"icon": "assets/${id}/icon.png",
|
||||||
|
|
||||||
|
"environment": "*",
|
||||||
|
"entrypoints": {
|
||||||
|
"main": [
|
||||||
|
"ella.${id}.${name}"
|
||||||
|
],
|
||||||
|
"client": [
|
||||||
|
"ella.${id}.${name}Client"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"mixins": [
|
||||||
|
],
|
||||||
|
|
||||||
|
"depends": {
|
||||||
|
"fabricloader": ">=0.11.3",
|
||||||
|
"fabric": "*",
|
||||||
|
"minecraft": "1.17.x",
|
||||||
|
"java": ">=16"
|
||||||
|
},
|
||||||
|
"suggests": {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
{"multipart":[{"when":{"powered":"false"},"apply":{"model":"techia:block/connector_base"}},{"when":{"powered":"true"},"apply":{"model":"techia:block/connector_base_on"}},{"when":{"up":"true","powered":"false"},"apply":{"model":"techia:block/connector_side","x":270}},{"when":{"up":"true","powered":"true"},"apply":{"model":"techia:block/connector_side_on","x":270}},{"when":{"down":"true","powered":"false"},"apply":{"model":"techia:block/connector_side","x":90}},{"when":{"down":"true","powered":"true"},"apply":{"model":"techia:block/connector_side_on","x":90}},{"when":{"north":"true","powered":"false"},"apply":{"model":"techia:block/connector_side","y":270}},{"when":{"north":"true","powered":"true"},"apply":{"model":"techia:block/connector_side_on","y":270}},{"when":{"east":"true","powered":"false"},"apply":{"model":"techia:block/connector_side"}},{"when":{"east":"true","powered":"true"},"apply":{"model":"techia:block/connector_side_on"}},{"when":{"south":"true","powered":"false"},"apply":{"model":"techia:block/connector_side","y":90}},{"when":{"south":"true","powered":"true"},"apply":{"model":"techia:block/connector_side_on","y":90}},{"when":{"west":"true","powered":"false"},"apply":{"model":"techia:block/connector_side","y":180}},{"when":{"west":"true","powered":"true"},"apply":{"model":"techia:block/connector_side_on","y":180}}]}
|
|
@ -0,0 +1,25 @@
|
||||||
|
{"parent":"minecraft:block/block","ambientocclusion":false,"elements":[
|
||||||
|
{"from":[2,0,2],"to":[14,12,5],"faces":{
|
||||||
|
"north":{"texture":"#particle"},
|
||||||
|
"south":{"texture":"#particle"},
|
||||||
|
}},
|
||||||
|
{"from":[2,0,11],"to":[14,12,14],"faces":{
|
||||||
|
"north":{"texture":"#particle"},
|
||||||
|
"south":{"texture":"#particle"},
|
||||||
|
}},
|
||||||
|
{"from":[2,0,2],"to":[5,12,14],"faces":{
|
||||||
|
"east":{"texture":"#particle"},
|
||||||
|
"west":{"texture":"#particle"},
|
||||||
|
}},
|
||||||
|
{"from":[11,0,2],"to":[14,12,14],"faces":{
|
||||||
|
"east":{"texture":"#particle"},
|
||||||
|
"west":{"texture":"#particle"},
|
||||||
|
}},
|
||||||
|
{"from":[2,0,2],"to":[14,3,14],"faces":{
|
||||||
|
"up":{"texture":"#particle"},
|
||||||
|
"down":{"texture":"#particle","cullface":"down"}
|
||||||
|
}},
|
||||||
|
{"from":[2,0,2],"to":[14,12,14],"faces":{
|
||||||
|
"up":{"texture":"#t"},
|
||||||
|
}}
|
||||||
|
]}
|
|
@ -0,0 +1 @@
|
||||||
|
{"parent":"minecraft:block/block","ambientocclusion":false,"textures":{"particle":"techia:block/connector"},"elements":[{"from":[5,5,5],"to":[11,11,11],"faces":{"north":{"texture":"#particle"},"east":{"texture":"#particle"},"south":{"texture":"#particle"},"west":{"texture":"#particle"},"up":{"texture":"#particle"},"down":{"texture":"#particle"}}}]}
|
|
@ -0,0 +1 @@
|
||||||
|
{"parent":"techia:block/connector_base","textures":{"particle":"techia:block/connector_on"}}
|
|
@ -0,0 +1 @@
|
||||||
|
{"ambientocclusion":false,"textures":{"particle":"techia:block/connector"},"elements":[{"from":[12,6,6],"to":[16,10,10],"faces":{"north":{"texture":"#particle"},"south":{"texture":"#particle"},"up":{"texture":"#particle"},"down":{"texture":"#particle"}}}]}
|
|
@ -0,0 +1 @@
|
||||||
|
{"parent":"techia:block/connector_side","textures":{"particle":"techia:block/connector_on"}}
|
|
@ -0,0 +1 @@
|
||||||
|
{"parent":"minecraft:block/block","ambientocclusion":false,"elements":[{"from":[2,0,2],"to":[14,12,14],"faces":{"north":{"texture":"#particle"},"east":{"texture":"#particle"},"south":{"texture":"#particle"},"west":{"texture":"#particle"},"up":{"texture":"#t"},"down":{"texture":"#b","cullface":"down"}}}]}
|
|
@ -0,0 +1 @@
|
||||||
|
{"parent":false,"textures":{"particle":"techia:block/workbench_side","t":"techia:block/workbench_top","b":"techia:block/workbench_bottom"}}
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"type": "techia:workbench",
|
||||||
|
"items": {
|
||||||
|
"techia:letium": 1,
|
||||||
|
"techia:asmite_ingot": 2
|
||||||
|
},
|
||||||
|
"result": "techia:connector",
|
||||||
|
"count": 2
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"type": "techia:workbench",
|
||||||
|
"items": {
|
||||||
|
"techia:letium": 1,
|
||||||
|
"techia:asmite_ingot": 2
|
||||||
|
},
|
||||||
|
"result": "techia:delayer",
|
||||||
|
"count": 2
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"type": "techia:workbench",
|
||||||
|
"items": {
|
||||||
|
"techia:letium": 1,
|
||||||
|
"techia:asmite_ingot": 2
|
||||||
|
},
|
||||||
|
"result": "techia:intersector",
|
||||||
|
"count": 2
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"type": "techia:workbench",
|
||||||
|
"items": {
|
||||||
|
"techia:letium": 1,
|
||||||
|
"techia:asmite_ingot": 2
|
||||||
|
},
|
||||||
|
"result": "techia:inverter",
|
||||||
|
"count": 2
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"type": "techia:smelting",
|
||||||
|
"shape": "techia:ingot_shape",
|
||||||
|
"items": {
|
||||||
|
"minecraft:gold_ingot": 2,
|
||||||
|
"minecraft:redstone": 3
|
||||||
|
},
|
||||||
|
"result": "techia:letium",
|
||||||
|
"count": 3
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"type": "techia:workbench",
|
||||||
|
"items": {
|
||||||
|
"techia:letium": 2,
|
||||||
|
"techia:asmite_block": 3
|
||||||
|
},
|
||||||
|
"result": "techia:piston",
|
||||||
|
"count": 2
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"type": "techia:workbench",
|
||||||
|
"items": {
|
||||||
|
"#minecraft:wooden_slabs": 2,
|
||||||
|
"techia:asmite_block": 2
|
||||||
|
},
|
||||||
|
"result": "techia:workbench",
|
||||||
|
"count": 2
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
{"type":"minecraft:crafting_shaped","pattern":["__","##"],"key":{"_":{"item":"#minecraft:wooden_slabs"},"#":{"item":"techia:asmite_block"}},"result":{"item":"techia:workbench"}}
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"type": "techreborn:alloy_smelter",
|
||||||
|
"power": 6,
|
||||||
|
"time": 200,
|
||||||
|
"ingredients": [
|
||||||
|
{"item": "minecraft:gold_ingot","count":2},
|
||||||
|
{"item": "minecraft:redstone","count":3}
|
||||||
|
],
|
||||||
|
"results": [
|
||||||
|
{
|
||||||
|
"item": "techia:letium",
|
||||||
|
"count": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = 'Fabric'
|
||||||
|
url = 'https://maven.fabricmc.net/'
|
||||||
|
}
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue