first commit

This commit is contained in:
Alexander Medvedev 2026-04-29 13:45:05 +02:00
parent 19fc59cd44
commit c2037ede01
49 changed files with 9173 additions and 0 deletions

677
LICENSE Normal file
View File

@ -0,0 +1,677 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized international standards body, or, in
the case of interfaces specified for a particular programming
language, one that is widely used among developers working in that
language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or modifying the covered
works for you must do so exclusively on your behalf, under your
direction and control, on terms that prohibit them from making any
copies of your copyrighted material outside their relationship with
you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where the
Corresponding Source is located. Regardless of what server hosts
the Corresponding Source, you remain obligated to ensure that it
is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal,
family, or household purposes, or (2) anything designed or sold for
incorporation into a dwelling. In determining whether a product is a
consumer product, doubtful cases shall be resolved in favor of coverage.
For a particular product received by a particular user, "normally used"
refers to a typical or common use of that class of product, regardless
of the status of the particular user or of the way in which the
particular user actually uses, or expects or is expected to use, the
product. A product is a consumer product regardless of whether the
product has substantial commercial, industrial or non-consumer uses,
unless such uses represent the only significant mode of use of the
product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as if they were included in this License, to the extent that
they are valid under applicable law. If additional permissions apply
only to part of the Program, that part may be used separately under
those permissions, but the entire Program remains governed by this
License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a surcharge for exercising rights granted under this
License, and you may not impose any (including a cross-claim or
counterclaim in a lawsuit) alleging that any patent claim is
infringed by making, using, selling, offering for sale, or importing
the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to any recipient of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

55
README.md Normal file
View File

@ -0,0 +1,55 @@
# Pumpkin Plugin API for Go
This package provides everything needed to write a Pumpkin server plugin compiled to WebAssembly using Go.
## Quick start
1. Initialize your Go module:
```bash
go mod init github.com/yourname/yourplugin
go get github.com/Pumpkin-MC/pumpkin-api-go
```
2. Create your plugin (`main.go`):
```go
package main
import (
"github.com/Pumpkin-MC/pumpkin-api-go/api"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_context"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_logging"
_ "github.com/Pumpkin-MC/pumpkin-api-go/pkg/wit_exports"
)
type MyPlugin struct {
api.DefaultPlugin
}
func (p *MyPlugin) Metadata() api.Metadata {
return api.Metadata{
Name: "my-go-plugin",
Version: "0.1.0",
Authors: []string{"you"},
}
}
func (p *MyPlugin) OnLoad(ctx *pumpkin_plugin_context.Context) {
pumpkin_plugin_logging.Log(pumpkin_plugin_logging.LevelInfo(), "Go plugin loaded!")
}
func init() {
api.RegisterPlugin(&MyPlugin{})
}
func main() {}
```
3. Build your plugin into a WebAssembly component using TinyGo:
```bash
tinygo build -o my_plugin.wasm -target=wasi main.go
```
Note: You might need to use `wit-component` to turn the core WASM into a component if your build tool doesn't do it automatically.

28
example/main.go Normal file
View File

@ -0,0 +1,28 @@
package main
import (
"github.com/Pumpkin-MC/pumpkin-api-go/api"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_context"
_ "github.com/Pumpkin-MC/pumpkin-api-go/pkg/wit_exports"
)
type MyPlugin struct {
api.DefaultPlugin
}
func (p *MyPlugin) Metadata() api.Metadata {
return api.Metadata{
Name: "GoExamplePlugin",
Version: "1.0.0",
Authors: []string{"Alex"},
}
}
func (p *MyPlugin) OnLoad(ctx *pumpkin_plugin_context.Context) {
}
func init() {
api.RegisterPlugin(&MyPlugin{})
}
func main() {}

17
generate.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/bash
# Ensure the submodule is initialized
git submodule update --init
# Generate the Go bindings
rm -rf pkg
mkdir -p pkg
# Note: We don't use --generate-stubs here because we have hand-written
# bridge code in internal/exports that maps the WIT exports to our
# higher-level Go API in the api/ package.
wit-bindgen go --pkg-name github.com/Pumpkin-MC/pumpkin-api-go/pkg \
--export-pkg-name github.com/Pumpkin-MC/pumpkin-api-go/internal/exports \
--out-dir pkg -w plugin wit/repo/pumpkin-plugin-wit/v0.1
echo "Bindings generated successfully in pkg/"

5
go.mod Normal file
View File

@ -0,0 +1,5 @@
module github.com/Pumpkin-MC/pumpkin-api-go
go 1.26.2
require go.bytecodealliance.org/pkg v0.2.1

2
go.sum Normal file
View File

@ -0,0 +1,2 @@
go.bytecodealliance.org/pkg v0.2.1 h1:TdRagooIcCW3UmlKqVO4cDR3GNDyfDnbiBzGI6TOvyg=
go.bytecodealliance.org/pkg v0.2.1/go.mod h1:OjA+V8g3uUFixeCKFfamm6sYhTJdg8fvwEdJ2GO0GSk=

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,24 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package export_pumpkin_plugin_metadata
import (
"github.com/Pumpkin-MC/pumpkin-api-go/api"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_metadata"
)
func GetMetadata() pumpkin_plugin_metadata.PluginMetadata {
if instance := api.GetInstance(); instance != nil {
return instance.Metadata()
}
return pumpkin_plugin_metadata.PluginMetadata{
Name: "unknown",
Version: "0.0.0",
Authors: nil,
Description: "No metadata",
Dependencies: nil,
}
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,52 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package export_wit_world
import (
"github.com/Pumpkin-MC/pumpkin-api-go/api"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_command"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_context"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_event"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_server"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_text"
witTypes "go.bytecodealliance.org/pkg/wit/types"
)
func InitPlugin() {
}
func OnLoad(ctx *pumpkin_plugin_context.Context) witTypes.Result[witTypes.Unit, string] {
if instance := api.GetInstance(); instance != nil {
instance.OnLoad(ctx)
}
return witTypes.Ok[witTypes.Unit, string](witTypes.Unit{})
}
func OnUnload(ctx *pumpkin_plugin_context.Context) witTypes.Result[witTypes.Unit, string] {
if instance := api.GetInstance(); instance != nil {
instance.OnUnload(ctx)
}
return witTypes.Ok[witTypes.Unit, string](witTypes.Unit{})
}
func HandleEvent(eventId uint32, server *pumpkin_plugin_server.Server, event pumpkin_plugin_event.Event) pumpkin_plugin_event.Event {
if instance := api.GetInstance(); instance != nil {
return instance.HandleEvent(eventId, server, event)
}
return event
}
func HandleCommand(commandId uint32, sender *pumpkin_plugin_command.CommandSender, server *pumpkin_plugin_server.Server, args *pumpkin_plugin_command.ConsumedArgs) witTypes.Result[int32, pumpkin_plugin_command.CommandError] {
if instance := api.GetInstance(); instance != nil {
result := instance.HandleCommand(commandId, sender, server, args)
return witTypes.Ok[int32, pumpkin_plugin_command.CommandError](result)
}
return witTypes.Err[int32, pumpkin_plugin_command.CommandError](pumpkin_plugin_command.MakeCommandErrorCommandFailed(pumpkin_plugin_text.TextComponentText("Plugin instance not found")))
}
func HandleTask(handlerId uint32, server *pumpkin_plugin_server.Server) {
// Not yet implemented in high-level API
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,273 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_block_entity
import (
witRuntime "go.bytecodealliance.org/pkg/wit/runtime"
witTypes "go.bytecodealliance.org/pkg/wit/types"
"runtime"
"unsafe"
)
type BlockPosition = witTypes.Tuple3[int32, int32, int32]
//go:wasmimport pumpkin:plugin/block-entity@0.1.0 [resource-drop]block-entity
func resourceDropBlockEntity(handle int32)
type BlockEntity struct {
handle *witRuntime.Handle
}
func (self *BlockEntity) TakeHandle() int32 {
return self.handle.Take()
}
func (self *BlockEntity) SetHandle(handle int32) {
self.handle.Set(handle)
}
func (self *BlockEntity) Handle() int32 {
return self.handle.Use()
}
func (self *BlockEntity) Drop() {
handle := self.handle.TakeOrNil()
if handle != 0 {
resourceDropBlockEntity(handle)
}
}
func BlockEntityFromOwnHandle(handleValue int32) *BlockEntity {
handle := witRuntime.MakeHandle(handleValue)
value := &BlockEntity{handle}
runtime.AddCleanup(value, func(_ int) {
handleValue := handle.TakeOrNil()
if handleValue != 0 {
resourceDropBlockEntity(handleValue)
}
}, 0)
return value
}
func BlockEntityFromBorrowHandle(handleValue int32) *BlockEntity {
handle := witRuntime.MakeHandle(handleValue)
return &BlockEntity{handle}
}
//go:wasmimport pumpkin:plugin/block-entity@0.1.0 [resource-drop]command-block-entity
func resourceDropCommandBlockEntity(handle int32)
type CommandBlockEntity struct {
handle *witRuntime.Handle
}
func (self *CommandBlockEntity) TakeHandle() int32 {
return self.handle.Take()
}
func (self *CommandBlockEntity) SetHandle(handle int32) {
self.handle.Set(handle)
}
func (self *CommandBlockEntity) Handle() int32 {
return self.handle.Use()
}
func (self *CommandBlockEntity) Drop() {
handle := self.handle.TakeOrNil()
if handle != 0 {
resourceDropCommandBlockEntity(handle)
}
}
func CommandBlockEntityFromOwnHandle(handleValue int32) *CommandBlockEntity {
handle := witRuntime.MakeHandle(handleValue)
value := &CommandBlockEntity{handle}
runtime.AddCleanup(value, func(_ int) {
handleValue := handle.TakeOrNil()
if handleValue != 0 {
resourceDropCommandBlockEntity(handleValue)
}
}, 0)
return value
}
func CommandBlockEntityFromBorrowHandle(handleValue int32) *CommandBlockEntity {
handle := witRuntime.MakeHandle(handleValue)
return &CommandBlockEntity{handle}
}
const (
BlockEntityTypeCommandBlockEntity uint8 = 0
)
type BlockEntityType struct {
tag uint8
value any
}
func (self BlockEntityType) Tag() uint8 {
return self.tag
}
func (self BlockEntityType) CommandBlockEntity() *CommandBlockEntity {
if self.tag != BlockEntityTypeCommandBlockEntity {
panic("tag mismatch")
}
return self.value.(*CommandBlockEntity)
}
func MakeBlockEntityTypeCommandBlockEntity(value *CommandBlockEntity) BlockEntityType {
return BlockEntityType{BlockEntityTypeCommandBlockEntity, value}
}
//go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]block-entity.resource-location
func wasm_import_method_block_entity_resource_location(arg0 int32, arg1 uintptr)
func (self *BlockEntity) ResourceLocation() string {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_block_entity_resource_location((self).Handle(), returnArea)
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
result := value
return result
}
//go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]block-entity.get-position
func wasm_import_method_block_entity_get_position(arg0 int32, arg1 uintptr)
func (self *BlockEntity) GetPosition() witTypes.Tuple3[int32, int32, int32] {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, 12, 4))
wasm_import_method_block_entity_get_position((self).Handle(), returnArea)
result := witTypes.Tuple3[int32, int32, int32]{*(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 0)), *(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 4)), *(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 8))}
return result
}
//go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]block-entity.get-id
func wasm_import_method_block_entity_get_id(arg0 int32) int32
func (self *BlockEntity) GetId() uint32 {
result := wasm_import_method_block_entity_get_id((self).Handle())
return uint32(result)
}
//go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]block-entity.is-dirty
func wasm_import_method_block_entity_is_dirty(arg0 int32) int32
func (self *BlockEntity) IsDirty() bool {
result := wasm_import_method_block_entity_is_dirty((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]block-entity.clear-dirty
func wasm_import_method_block_entity_clear_dirty(arg0 int32)
func (self *BlockEntity) ClearDirty() {
wasm_import_method_block_entity_clear_dirty((self).Handle())
}
//go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]command-block-entity.get-block-entity
func wasm_import_method_command_block_entity_get_block_entity(arg0 int32) int32
func (self *CommandBlockEntity) GetBlockEntity() *BlockEntity {
result := wasm_import_method_command_block_entity_get_block_entity((self).Handle())
return BlockEntityFromOwnHandle(int32(uintptr(result)))
}
//go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]command-block-entity.last-output
func wasm_import_method_command_block_entity_last_output(arg0 int32, arg1 uintptr)
func (self *CommandBlockEntity) LastOutput() string {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_command_block_entity_last_output((self).Handle(), returnArea)
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
result := value
return result
}
//go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]command-block-entity.track-output
func wasm_import_method_command_block_entity_track_output(arg0 int32) int32
func (self *CommandBlockEntity) TrackOutput() bool {
result := wasm_import_method_command_block_entity_track_output((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]command-block-entity.success-count
func wasm_import_method_command_block_entity_success_count(arg0 int32) int32
func (self *CommandBlockEntity) SuccessCount() uint32 {
result := wasm_import_method_command_block_entity_success_count((self).Handle())
return uint32(result)
}
//go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]command-block-entity.command
func wasm_import_method_command_block_entity_command(arg0 int32, arg1 uintptr)
func (self *CommandBlockEntity) Command() string {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_command_block_entity_command((self).Handle(), returnArea)
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
result := value
return result
}
//go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]command-block-entity.auto
func wasm_import_method_command_block_entity_auto(arg0 int32) int32
func (self *CommandBlockEntity) Auto() bool {
result := wasm_import_method_command_block_entity_auto((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]command-block-entity.condition-met
func wasm_import_method_command_block_entity_condition_met(arg0 int32) int32
func (self *CommandBlockEntity) ConditionMet() bool {
result := wasm_import_method_command_block_entity_condition_met((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]command-block-entity.powered
func wasm_import_method_command_block_entity_powered(arg0 int32) int32
func (self *CommandBlockEntity) Powered() bool {
result := wasm_import_method_command_block_entity_powered((self).Handle())
return (result != 0)
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,270 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_boss_bar
import (
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_player"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_text"
witRuntime "go.bytecodealliance.org/pkg/wit/runtime"
"runtime"
"unsafe"
)
type TextComponent = pumpkin_plugin_text.TextComponent
type Player = pumpkin_plugin_player.Player
const (
BossBarColorPink uint8 = 0
BossBarColorBlue uint8 = 1
BossBarColorRed uint8 = 2
BossBarColorGreen uint8 = 3
BossBarColorYellow uint8 = 4
BossBarColorPurple uint8 = 5
BossBarColorWhite uint8 = 6
)
// Represents the color of a boss bar.
type BossBarColor = uint8
const (
BossBarDivisionNoDivision uint8 = 0
BossBarDivisionNotches6 uint8 = 1
BossBarDivisionNotches10 uint8 = 2
BossBarDivisionNotches12 uint8 = 3
BossBarDivisionNotches20 uint8 = 4
)
// Represents the notches/divisions of a boss bar.
type BossBarDivision = uint8
// Metadata flags that can be toggled on a boss bar.
type BossBarMetadata struct {
// Darkens the sky for players who see the boss bar.
DarkenSky bool
// If true, the bar is considered a "dragon bar" (used for Ender Dragon).
DragonBar bool
// If true, fog is created around the players who see the boss bar.
CreateFog bool
}
//go:wasmimport pumpkin:plugin/boss-bar@0.1.0 [resource-drop]boss-bar
func resourceDropBossBar(handle int32)
// Represents a boss bar that can be shown to players.
type BossBar struct {
handle *witRuntime.Handle
}
func (self *BossBar) TakeHandle() int32 {
return self.handle.Take()
}
func (self *BossBar) SetHandle(handle int32) {
self.handle.Set(handle)
}
func (self *BossBar) Handle() int32 {
return self.handle.Use()
}
func (self *BossBar) Drop() {
handle := self.handle.TakeOrNil()
if handle != 0 {
resourceDropBossBar(handle)
}
}
func BossBarFromOwnHandle(handleValue int32) *BossBar {
handle := witRuntime.MakeHandle(handleValue)
value := &BossBar{handle}
runtime.AddCleanup(value, func(_ int) {
handleValue := handle.TakeOrNil()
if handleValue != 0 {
resourceDropBossBar(handleValue)
}
}, 0)
return value
}
func BossBarFromBorrowHandle(handleValue int32) *BossBar {
handle := witRuntime.MakeHandle(handleValue)
return &BossBar{handle}
}
//go:wasmimport pumpkin:plugin/boss-bar@0.1.0 [constructor]boss-bar
func wasm_import_constructor_boss_bar(arg0 int32, arg1 int32, arg2 int32) int32
func MakeBossBar(title *pumpkin_plugin_text.TextComponent, color BossBarColor, division BossBarDivision) *BossBar {
result := wasm_import_constructor_boss_bar((title).TakeHandle(), int32(color), int32(division))
return BossBarFromOwnHandle(int32(uintptr(result)))
}
//go:wasmimport pumpkin:plugin/boss-bar@0.1.0 [method]boss-bar.get-title
func wasm_import_method_boss_bar_get_title(arg0 int32) int32
func (self *BossBar) GetTitle() *pumpkin_plugin_text.TextComponent {
result := wasm_import_method_boss_bar_get_title((self).Handle())
return pumpkin_plugin_text.TextComponentFromOwnHandle(int32(uintptr(result)))
}
//go:wasmimport pumpkin:plugin/boss-bar@0.1.0 [method]boss-bar.set-title
func wasm_import_method_boss_bar_set_title(arg0 int32, arg1 int32)
func (self *BossBar) SetTitle(title *pumpkin_plugin_text.TextComponent) {
wasm_import_method_boss_bar_set_title((self).Handle(), (title).TakeHandle())
}
//go:wasmimport pumpkin:plugin/boss-bar@0.1.0 [method]boss-bar.get-health
func wasm_import_method_boss_bar_get_health(arg0 int32) float32
func (self *BossBar) GetHealth() float32 {
result := wasm_import_method_boss_bar_get_health((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/boss-bar@0.1.0 [method]boss-bar.set-health
func wasm_import_method_boss_bar_set_health(arg0 int32, arg1 float32)
func (self *BossBar) SetHealth(health float32) {
wasm_import_method_boss_bar_set_health((self).Handle(), health)
}
//go:wasmimport pumpkin:plugin/boss-bar@0.1.0 [method]boss-bar.get-color
func wasm_import_method_boss_bar_get_color(arg0 int32) int32
func (self *BossBar) GetColor() BossBarColor {
result := wasm_import_method_boss_bar_get_color((self).Handle())
return uint8(result)
}
//go:wasmimport pumpkin:plugin/boss-bar@0.1.0 [method]boss-bar.set-color
func wasm_import_method_boss_bar_set_color(arg0 int32, arg1 int32)
func (self *BossBar) SetColor(color BossBarColor) {
wasm_import_method_boss_bar_set_color((self).Handle(), int32(color))
}
//go:wasmimport pumpkin:plugin/boss-bar@0.1.0 [method]boss-bar.get-division
func wasm_import_method_boss_bar_get_division(arg0 int32) int32
func (self *BossBar) GetDivision() BossBarDivision {
result := wasm_import_method_boss_bar_get_division((self).Handle())
return uint8(result)
}
//go:wasmimport pumpkin:plugin/boss-bar@0.1.0 [method]boss-bar.set-division
func wasm_import_method_boss_bar_set_division(arg0 int32, arg1 int32)
func (self *BossBar) SetDivision(division BossBarDivision) {
wasm_import_method_boss_bar_set_division((self).Handle(), int32(division))
}
//go:wasmimport pumpkin:plugin/boss-bar@0.1.0 [method]boss-bar.get-metadata
func wasm_import_method_boss_bar_get_metadata(arg0 int32, arg1 uintptr)
func (self *BossBar) GetMetadata() BossBarMetadata {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, 3, 1))
wasm_import_method_boss_bar_get_metadata((self).Handle(), returnArea)
result := BossBarMetadata{(uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))) != 0), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 1))) != 0), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 2))) != 0)}
return result
}
//go:wasmimport pumpkin:plugin/boss-bar@0.1.0 [method]boss-bar.set-metadata
func wasm_import_method_boss_bar_set_metadata(arg0 int32, arg1 int32, arg2 int32, arg3 int32)
func (self *BossBar) SetMetadata(metadata BossBarMetadata) {
var result int32
if (metadata).DarkenSky {
result = 1
} else {
result = 0
}
var result0 int32
if (metadata).DragonBar {
result0 = 1
} else {
result0 = 0
}
var result1 int32
if (metadata).CreateFog {
result1 = 1
} else {
result1 = 0
}
wasm_import_method_boss_bar_set_metadata((self).Handle(), result, result0, result1)
}
//go:wasmimport pumpkin:plugin/boss-bar@0.1.0 [method]boss-bar.add-player
func wasm_import_method_boss_bar_add_player(arg0 int32, arg1 int32)
func (self *BossBar) AddPlayer(player *pumpkin_plugin_player.Player) {
wasm_import_method_boss_bar_add_player((self).Handle(), (player).TakeHandle())
}
//go:wasmimport pumpkin:plugin/boss-bar@0.1.0 [method]boss-bar.remove-player
func wasm_import_method_boss_bar_remove_player(arg0 int32, arg1 int32)
func (self *BossBar) RemovePlayer(player *pumpkin_plugin_player.Player) {
wasm_import_method_boss_bar_remove_player((self).Handle(), (player).TakeHandle())
}
//go:wasmimport pumpkin:plugin/boss-bar@0.1.0 [method]boss-bar.get-players
func wasm_import_method_boss_bar_get_players(arg0 int32, arg1 uintptr)
func (self *BossBar) GetPlayers() []*pumpkin_plugin_player.Player {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_boss_bar_get_players((self).Handle(), returnArea)
result := make([]*pumpkin_plugin_player.Player, 0, *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
for index := 0; index < int(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4))); index++ {
base := unsafe.Add(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0)))), index*4)
result = append(result, pumpkin_plugin_player.PlayerFromOwnHandle(int32(uintptr(*(*int32)(unsafe.Add(unsafe.Pointer(base), 0))))))
}
result0 := result
return result0
}
//go:wasmimport pumpkin:plugin/boss-bar@0.1.0 [method]boss-bar.remove-all
func wasm_import_method_boss_bar_remove_all(arg0 int32)
func (self *BossBar) RemoveAll() {
wasm_import_method_boss_bar_remove_all((self).Handle())
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,257 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_common
import (
witTypes "go.bytecodealliance.org/pkg/wit/types"
)
// Serialized text component as a postcard byte array.
// @deprecated Use the text-component resource from the text interface instead.
type RawTextComponent = []uint8
// A position in the world grid (integers).
type BlockPosition = witTypes.Tuple3[int32, int32, int32]
// A precise coordinate in the world (floats).
type Position = witTypes.Tuple3[float64, float64, float64]
const (
HandLeft uint8 = 0
HandRight uint8 = 1
)
// Represents the hands of a player.
type Hand = uint8
const (
GameModeSurvival uint8 = 0
GameModeCreative uint8 = 1
GameModeAdventure uint8 = 2
GameModeSpectator uint8 = 3
)
// Represents the game modes available in Minecraft.
type GameMode = uint8
const (
NamedColorBlack uint8 = 0
NamedColorDarkBlue uint8 = 1
NamedColorDarkGreen uint8 = 2
NamedColorDarkAqua uint8 = 3
NamedColorDarkRed uint8 = 4
NamedColorDarkPurple uint8 = 5
NamedColorGold uint8 = 6
NamedColorGray uint8 = 7
NamedColorDarkGray uint8 = 8
NamedColorBlue uint8 = 9
NamedColorGreen uint8 = 10
NamedColorAqua uint8 = 11
NamedColorRed uint8 = 12
NamedColorLightPurple uint8 = 13
NamedColorYellow uint8 = 14
NamedColorWhite uint8 = 15
)
// The 16 base Minecraft colors.
type NamedColor = uint8
// An RGB color represented by its red, green, and blue components.
type RgbColor struct {
R uint8
G uint8
B uint8
}
// An ARGB color with alpha (transparency) channel.
type ArgbColor struct {
A uint8
R uint8
G uint8
B uint8
}
// Represents a stack of items with its type and count.
type ItemStack struct {
// The unique registry key (e.g., "minecraft:diamond").
RegistryKey string
// The number of items in the stack.
Count uint8
}
const (
ClickTypeLeft uint8 = 0
ClickTypeRight uint8 = 1
ClickTypeShiftLeft uint8 = 2
ClickTypeShiftRight uint8 = 3
ClickTypeMiddle uint8 = 4
ClickTypeDrop uint8 = 5
ClickTypeControlDrop uint8 = 6
ClickTypeDoubleClick uint8 = 7
ClickTypeNumberKey uint8 = 8
ClickTypeUnknown uint8 = 9
)
// Represents the type of click interaction in a GUI.
type ClickType = uint8
const (
EntityPoseStanding uint8 = 0
EntityPoseFallFlying uint8 = 1
EntityPoseSleeping uint8 = 2
EntityPoseSwimming uint8 = 3
EntityPoseSpinAttack uint8 = 4
EntityPoseCrouching uint8 = 5
EntityPoseLongJumping uint8 = 6
EntityPoseDying uint8 = 7
EntityPoseCroaking uint8 = 8
EntityPoseUsingTongue uint8 = 9
EntityPoseSitting uint8 = 10
EntityPoseRoaring uint8 = 11
EntityPoseSniffing uint8 = 12
EntityPoseEmerging uint8 = 13
EntityPoseDigging uint8 = 14
EntityPoseSliding uint8 = 15
EntityPoseShooting uint8 = 16
EntityPoseInhaling uint8 = 17
)
// Represents the various poses an entity can be in.
type EntityPose = uint8
const (
LocaleAfZa uint8 = 0
LocaleArSa uint8 = 1
LocaleAstEs uint8 = 2
LocaleAzAz uint8 = 3
LocaleBaRu uint8 = 4
LocaleBar uint8 = 5
LocaleBeBy uint8 = 6
LocaleBgBg uint8 = 7
LocaleBrFr uint8 = 8
LocaleBrb uint8 = 9
LocaleBsBa uint8 = 10
LocaleCaEs uint8 = 11
LocaleCsCz uint8 = 12
LocaleCyGb uint8 = 13
LocaleDaDk uint8 = 14
LocaleDeAt uint8 = 15
LocaleDeCh uint8 = 16
LocaleDeDe uint8 = 17
LocaleElGr uint8 = 18
LocaleEnAu uint8 = 19
LocaleEnCa uint8 = 20
LocaleEnGb uint8 = 21
LocaleEnNz uint8 = 22
LocaleEnPt uint8 = 23
LocaleEnUd uint8 = 24
LocaleEnUs uint8 = 25
LocaleEnp uint8 = 26
LocaleEnws uint8 = 27
LocaleEoUy uint8 = 28
LocaleEsAr uint8 = 29
LocaleEsCl uint8 = 30
LocaleEsEc uint8 = 31
LocaleEsEs uint8 = 32
LocaleEsMx uint8 = 33
LocaleEsUy uint8 = 34
LocaleEsVe uint8 = 35
LocaleEsan uint8 = 36
LocaleEtEe uint8 = 37
LocaleEuEs uint8 = 38
LocaleFaIr uint8 = 39
LocaleFiFi uint8 = 40
LocaleFilPh uint8 = 41
LocaleFoFo uint8 = 42
LocaleFrCa uint8 = 43
LocaleFrFr uint8 = 44
LocaleFraDe uint8 = 45
LocaleFurIt uint8 = 46
LocaleFyNl uint8 = 47
LocaleGaIe uint8 = 48
LocaleGdGb uint8 = 49
LocaleGlEs uint8 = 50
LocaleHawUs uint8 = 51
LocaleHeIl uint8 = 52
LocaleHiIn uint8 = 53
LocaleHrHr uint8 = 54
LocaleHuHu uint8 = 55
LocaleHyAm uint8 = 56
LocaleIdId uint8 = 57
LocaleIgNg uint8 = 58
LocaleIoEn uint8 = 59
LocaleIsIs uint8 = 60
LocaleIsv uint8 = 61
LocaleItIt uint8 = 62
LocaleJaJp uint8 = 63
LocaleJboEn uint8 = 64
LocaleKaGe uint8 = 65
LocaleKkKz uint8 = 66
LocaleKnIn uint8 = 67
LocaleKoKr uint8 = 68
LocaleKsh uint8 = 69
LocaleKwGb uint8 = 70
LocaleLaLa uint8 = 71
LocaleLbLu uint8 = 72
LocaleLiLi uint8 = 73
LocaleLmo uint8 = 74
LocaleLoLa uint8 = 75
LocaleLolUs uint8 = 76
LocaleLtLt uint8 = 77
LocaleLvLv uint8 = 78
LocaleLzh uint8 = 79
LocaleMkMk uint8 = 80
LocaleMnMn uint8 = 81
LocaleMsMy uint8 = 82
LocaleMtMt uint8 = 83
LocaleNah uint8 = 84
LocaleNdsDe uint8 = 85
LocaleNlBe uint8 = 86
LocaleNlNl uint8 = 87
LocaleNnNo uint8 = 88
LocaleNoNo uint8 = 89
LocaleOcFr uint8 = 90
LocaleOvd uint8 = 91
LocalePlPl uint8 = 92
LocalePtBr uint8 = 93
LocalePtPt uint8 = 94
LocaleQyaAa uint8 = 95
LocaleRoRo uint8 = 96
LocaleRpr uint8 = 97
LocaleRuRu uint8 = 98
LocaleRyUa uint8 = 99
LocaleSahSah uint8 = 100
LocaleSeNo uint8 = 101
LocaleSkSk uint8 = 102
LocaleSlSi uint8 = 103
LocaleSoSo uint8 = 104
LocaleSqAl uint8 = 105
LocaleSrCs uint8 = 106
LocaleSrSp uint8 = 107
LocaleSvSe uint8 = 108
LocaleSxu uint8 = 109
LocaleSzl uint8 = 110
LocaleTaIn uint8 = 111
LocaleThTh uint8 = 112
LocaleTlPh uint8 = 113
LocaleTlhAa uint8 = 114
LocaleTok uint8 = 115
LocaleTrTr uint8 = 116
LocaleTtRu uint8 = 117
LocaleUkUa uint8 = 118
LocaleValEs uint8 = 119
LocaleVecIt uint8 = 120
LocaleViVn uint8 = 121
LocaleYiDe uint8 = 122
LocaleYoNg uint8 = 123
LocaleZhCn uint8 = 124
LocaleZhHk uint8 = 125
LocaleZhTw uint8 = 126
LocaleZlmArab uint8 = 127
)
// All Minecraft-supported locales.
type Locale = uint8

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,191 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_context
import (
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_command"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_event"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_permission"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_server"
witRuntime "go.bytecodealliance.org/pkg/wit/runtime"
witTypes "go.bytecodealliance.org/pkg/wit/types"
"runtime"
"unsafe"
)
type Server = pumpkin_plugin_server.Server
type EventType = pumpkin_plugin_event.EventType
type EventPriority = pumpkin_plugin_event.EventPriority
type Command = pumpkin_plugin_command.Command
type Permission = pumpkin_plugin_permission.Permission
//go:wasmimport pumpkin:plugin/context@0.1.0 [resource-drop]context
func resourceDropContext(handle int32)
// A contextual handle for plugin-related operations.
type Context struct {
handle *witRuntime.Handle
}
func (self *Context) TakeHandle() int32 {
return self.handle.Take()
}
func (self *Context) SetHandle(handle int32) {
self.handle.Set(handle)
}
func (self *Context) Handle() int32 {
return self.handle.Use()
}
func (self *Context) Drop() {
handle := self.handle.TakeOrNil()
if handle != 0 {
resourceDropContext(handle)
}
}
func ContextFromOwnHandle(handleValue int32) *Context {
handle := witRuntime.MakeHandle(handleValue)
value := &Context{handle}
runtime.AddCleanup(value, func(_ int) {
handleValue := handle.TakeOrNil()
if handleValue != 0 {
resourceDropContext(handleValue)
}
}, 0)
return value
}
func ContextFromBorrowHandle(handleValue int32) *Context {
handle := witRuntime.MakeHandle(handleValue)
return &Context{handle}
}
//go:wasmimport pumpkin:plugin/context@0.1.0 [method]context.register-event
func wasm_import_method_context_register_event(arg0 int32, arg1 int32, arg2 int32, arg3 int32, arg4 int32)
func (self *Context) RegisterEvent(handlerId uint32, eventType pumpkin_plugin_event.EventType, eventPriority pumpkin_plugin_event.EventPriority, blocking bool) {
var result int32
if blocking {
result = 1
} else {
result = 0
}
wasm_import_method_context_register_event((self).Handle(), int32(handlerId), int32(eventType), int32(eventPriority), result)
}
//go:wasmimport pumpkin:plugin/context@0.1.0 [method]context.register-command
func wasm_import_method_context_register_command(arg0 int32, arg1 int32, arg2 uintptr, arg3 uint32)
func (self *Context) RegisterCommand(command *pumpkin_plugin_command.Command, permission string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(permission))
pinner.Pin(utf8)
wasm_import_method_context_register_command((self).Handle(), (command).TakeHandle(), uintptr(utf8), uint32(len(permission)))
}
//go:wasmimport pumpkin:plugin/context@0.1.0 [method]context.register-permission
func wasm_import_method_context_register_permission(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr, arg4 uint32, arg5 int32, arg6 int32, arg7 uintptr, arg8 uint32, arg9 uintptr)
func (self *Context) RegisterPermission(permission pumpkin_plugin_permission.Permission) witTypes.Result[witTypes.Unit, string] {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (3 * 4), 4))
utf8 := unsafe.Pointer(unsafe.StringData((permission).Node))
pinner.Pin(utf8)
utf80 := unsafe.Pointer(unsafe.StringData((permission).Description))
pinner.Pin(utf80)
var variant int32
var variant1 int32
switch (permission).Default.Tag() {
case pumpkin_plugin_permission.PermissionDefaultDeny:
variant = int32(0)
variant1 = 0
case pumpkin_plugin_permission.PermissionDefaultAllow:
variant = int32(1)
variant1 = 0
case pumpkin_plugin_permission.PermissionDefaultOp:
payload := (permission).Default.Op()
variant = int32(2)
variant1 = int32(payload)
default:
panic("unreachable")
}
slice := (permission).Children
length := uint32(len(slice))
result3 := witRuntime.Allocate(pinner, uintptr(length*(3*4)), 4)
for index, element := range slice {
base := unsafe.Add(result3, index*(3*4))
utf82 := unsafe.Pointer(unsafe.StringData((element).Node))
pinner.Pin(utf82)
*(*uint32)(unsafe.Add(unsafe.Pointer(base), 4)) = uint32(uint32(len((element).Node)))
*(*uint32)(unsafe.Add(unsafe.Pointer(base), 0)) = uint32(uintptr(uintptr(utf82)))
var result int32
if (element).Value {
result = 1
} else {
result = 0
}
*(*int8)(unsafe.Add(unsafe.Pointer(base), (2 * 4))) = int8(result)
}
wasm_import_method_context_register_permission((self).Handle(), uintptr(utf8), uint32(len((permission).Node)), uintptr(utf80), uint32(len((permission).Description)), variant, variant1, uintptr(result3), length, returnArea)
var result4 witTypes.Result[witTypes.Unit, string]
switch uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))) {
case 0:
result4 = witTypes.Ok[witTypes.Unit, string](witTypes.Unit{})
case 1:
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (2 * 4))))
result4 = witTypes.Err[witTypes.Unit, string](value)
default:
panic("unreachable")
}
result5 := result4
return result5
}
//go:wasmimport pumpkin:plugin/context@0.1.0 [method]context.get-data-folder
func wasm_import_method_context_get_data_folder(arg0 int32, arg1 uintptr)
func (self *Context) GetDataFolder() string {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_context_get_data_folder((self).Handle(), returnArea)
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
result := value
return result
}
//go:wasmimport pumpkin:plugin/context@0.1.0 [method]context.get-server
func wasm_import_method_context_get_server(arg0 int32) int32
func (self *Context) GetServer() *pumpkin_plugin_server.Server {
result := wasm_import_method_context_get_server((self).Handle())
return pumpkin_plugin_server.ServerFromOwnHandle(int32(uintptr(result)))
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,12 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_entity
import (
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_world"
)
type Entity = pumpkin_plugin_world.Entity

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,667 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_event
import (
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_common"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_player"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_text"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_world"
witTypes "go.bytecodealliance.org/pkg/wit/types"
)
type BlockPosition = witTypes.Tuple3[int32, int32, int32]
type GameMode = pumpkin_plugin_common.GameMode
type Hand = pumpkin_plugin_common.Hand
type ItemStack = pumpkin_plugin_common.ItemStack
type Position = witTypes.Tuple3[float64, float64, float64]
type ClickType = pumpkin_plugin_common.ClickType
type Player = pumpkin_plugin_player.Player
type TextComponent = pumpkin_plugin_text.TextComponent
type World = pumpkin_plugin_world.World
const (
EventPriorityHighest uint8 = 0
EventPriorityHigh uint8 = 1
EventPriorityNormal uint8 = 2
EventPriorityLow uint8 = 3
EventPriorityLowest uint8 = 4
)
type EventPriority = uint8
type PlayerJoinEventData struct {
Player *pumpkin_plugin_player.Player
JoinMessage *pumpkin_plugin_text.TextComponent
Cancelled bool
}
type PlayerLeaveEventData struct {
Player *pumpkin_plugin_player.Player
LeaveMessage *pumpkin_plugin_text.TextComponent
Cancelled bool
}
type PlayerLoginEventData struct {
Player *pumpkin_plugin_player.Player
KickMessage *pumpkin_plugin_text.TextComponent
Cancelled bool
}
type PlayerChatEventData struct {
Player *pumpkin_plugin_player.Player
Message string
Recipients []*pumpkin_plugin_player.Player
Cancelled bool
}
type PlayerCommandSendEventData struct {
Player *pumpkin_plugin_player.Player
Command string
Cancelled bool
}
type PlayerPermissionCheckEventData struct {
Player *pumpkin_plugin_player.Player
Permission string
PermissionResult bool
}
type PlayerMoveEventData struct {
Player *pumpkin_plugin_player.Player
FromPosition witTypes.Tuple3[float64, float64, float64]
ToPosition witTypes.Tuple3[float64, float64, float64]
Cancelled bool
}
type PlayerTeleportEventData struct {
Player *pumpkin_plugin_player.Player
FromPosition witTypes.Tuple3[float64, float64, float64]
ToPosition witTypes.Tuple3[float64, float64, float64]
Cancelled bool
}
type PlayerChangeWorldEventData struct {
Player *pumpkin_plugin_player.Player
PreviousWorld *pumpkin_plugin_world.World
NewWorld *pumpkin_plugin_world.World
Position witTypes.Tuple3[float64, float64, float64]
Yaw float32
Pitch float32
Cancelled bool
}
type PlayerExpChangeEventData struct {
Player *pumpkin_plugin_player.Player
Amount int32
}
type PlayerItemHeldEventData struct {
Player *pumpkin_plugin_player.Player
PreviousSlot uint8
NewSlot uint8
Cancelled bool
}
type PlayerChangedMainHandEventData struct {
Player *pumpkin_plugin_player.Player
MainHand pumpkin_plugin_common.Hand
}
type PlayerGamemodeChangeEventData struct {
Player *pumpkin_plugin_player.Player
PreviousGamemode pumpkin_plugin_common.GameMode
NewGamemode pumpkin_plugin_common.GameMode
Cancelled bool
}
type PlayerCustomPayloadEventData struct {
Player *pumpkin_plugin_player.Player
Channel string
Data []uint8
}
const (
PlayerFishStateFishing uint8 = 0
PlayerFishStateCaughtFish uint8 = 1
PlayerFishStateCaughtEntity uint8 = 2
PlayerFishStateInGround uint8 = 3
PlayerFishStateFailedAttempt uint8 = 4
PlayerFishStateReelIn uint8 = 5
PlayerFishStateBite uint8 = 6
)
type PlayerFishState = uint8
type PlayerFishEventData struct {
Player *pumpkin_plugin_player.Player
CaughtUuid witTypes.Option[string]
CaughtType string
HookUuid string
State PlayerFishState
Hand pumpkin_plugin_common.Hand
ExpToDrop int32
Cancelled bool
}
type PlayerEggThrowEventData struct {
Player *pumpkin_plugin_player.Player
EggUuid string
Hatching bool
NumHatches uint8
HatchingType string
Cancelled bool
}
const (
EntityInteractionActionInteract uint8 = 0
EntityInteractionActionAttack uint8 = 1
EntityInteractionActionInteractAt uint8 = 2
)
type EntityInteractionAction = uint8
const (
InteractActionLeftClickBlock uint8 = 0
InteractActionLeftClickAir uint8 = 1
InteractActionRightClickAir uint8 = 2
InteractActionRightClickBlock uint8 = 3
)
type InteractAction = uint8
type PlayerInteractEventData struct {
Player *pumpkin_plugin_player.Player
Action InteractAction
ClickedPos witTypes.Option[witTypes.Tuple3[int32, int32, int32]]
Block string
Cancelled bool
}
type PlayerToggleSneakEventData struct {
Player *pumpkin_plugin_player.Player
IsSneaking bool
Cancelled bool
}
type PlayerToggleFlightEventData struct {
Player *pumpkin_plugin_player.Player
IsFlying bool
Cancelled bool
}
type PlayerToggleSprintEventData struct {
Player *pumpkin_plugin_player.Player
IsSprinting bool
Cancelled bool
}
type PlayerInteractUnknownEntityEventData struct {
Player *pumpkin_plugin_player.Player
EntityId int32
Action EntityInteractionAction
Cancelled bool
}
type InventoryClickEventData struct {
Player *pumpkin_plugin_player.Player
WindowType witTypes.Option[string]
ClickType pumpkin_plugin_common.ClickType
Slot int16
RawSlot int16
ClickedItem witTypes.Option[pumpkin_plugin_common.ItemStack]
Cursor witTypes.Option[pumpkin_plugin_common.ItemStack]
HotbarButton int32
Cancelled bool
}
type InventoryCloseEventData struct {
Player *pumpkin_plugin_player.Player
WindowType witTypes.Option[string]
}
type BlockRedstoneEventData struct {
TargetWorld *pumpkin_plugin_world.World
StateId uint16
BlockPosition witTypes.Tuple3[int32, int32, int32]
OldCurrent int32
NewCurrent int32
Cancelled bool
}
type BlockBreakEventData struct {
Player witTypes.Option[*pumpkin_plugin_player.Player]
Block string
BlockPosition witTypes.Tuple3[int32, int32, int32]
Exp uint32
ShouldDrop bool
Cancelled bool
}
type BlockBurnEventData struct {
IgnitingBlock string
Block string
Cancelled bool
}
type BlockCanBuildEventData struct {
BlockToBuild string
Buildable bool
Player *pumpkin_plugin_player.Player
Block string
Cancelled bool
}
type BlockGrowEventData struct {
TargetWorld *pumpkin_plugin_world.World
OldBlock string
OldStateId uint16
NewBlock string
NewStateId uint16
BlockPosition witTypes.Tuple3[int32, int32, int32]
Cancelled bool
}
type BlockPlaceEventData struct {
Player *pumpkin_plugin_player.Player
BlockPlaced string
BlockPlacedAgainst string
BlockPosition witTypes.Tuple3[int32, int32, int32]
CanBuild bool
Cancelled bool
}
type ServerCommandEventData struct {
Command string
Cancelled bool
}
type SpawnChangeEventData struct {
TargetWorld *pumpkin_plugin_world.World
PreviousPosition witTypes.Tuple3[int32, int32, int32]
PreviousYaw float32
PreviousPitch float32
NewPosition witTypes.Tuple3[int32, int32, int32]
NewYaw float32
NewPitch float32
}
type ServerBroadcastEventData struct {
Message *pumpkin_plugin_text.TextComponent
Sender *pumpkin_plugin_text.TextComponent
Cancelled bool
}
const (
EventTypePlayerJoinEvent uint8 = 0
EventTypePlayerLeaveEvent uint8 = 1
EventTypePlayerLoginEvent uint8 = 2
EventTypePlayerChatEvent uint8 = 3
EventTypePlayerCommandSendEvent uint8 = 4
EventTypePlayerPermissionCheckEvent uint8 = 5
EventTypePlayerMoveEvent uint8 = 6
EventTypePlayerTeleportEvent uint8 = 7
EventTypePlayerChangeWorldEvent uint8 = 8
EventTypePlayerExpChangeEvent uint8 = 9
EventTypePlayerItemHeldEvent uint8 = 10
EventTypePlayerChangedMainHandEvent uint8 = 11
EventTypePlayerGamemodeChangeEvent uint8 = 12
EventTypePlayerCustomPayloadEvent uint8 = 13
EventTypePlayerFishEvent uint8 = 14
EventTypePlayerEggThrowEvent uint8 = 15
EventTypePlayerInteractUnknownEntityEvent uint8 = 16
EventTypePlayerInteractEvent uint8 = 17
EventTypePlayerToggleSneakEvent uint8 = 18
EventTypePlayerToggleFlightEvent uint8 = 19
EventTypePlayerToggleSprintEvent uint8 = 20
EventTypeInventoryClickEvent uint8 = 21
EventTypeInventoryCloseEvent uint8 = 22
EventTypeBlockRedstoneEvent uint8 = 23
EventTypeBlockBreakEvent uint8 = 24
EventTypeBlockBurnEvent uint8 = 25
EventTypeBlockCanBuildEvent uint8 = 26
EventTypeBlockGrowEvent uint8 = 27
EventTypeBlockPlaceEvent uint8 = 28
EventTypeServerCommandEvent uint8 = 29
EventTypeSpawnChangeEvent uint8 = 30
EventTypeServerBroadcastEvent uint8 = 31
)
type EventType = uint8
const (
EventPlayerJoinEvent uint8 = 0
EventPlayerLeaveEvent uint8 = 1
EventPlayerLoginEvent uint8 = 2
EventPlayerChatEvent uint8 = 3
EventPlayerCommandSendEvent uint8 = 4
EventPlayerPermissionCheckEvent uint8 = 5
EventPlayerMoveEvent uint8 = 6
EventPlayerTeleportEvent uint8 = 7
EventPlayerChangeWorldEvent uint8 = 8
EventPlayerExpChangeEvent uint8 = 9
EventPlayerItemHeldEvent uint8 = 10
EventPlayerChangedMainHandEvent uint8 = 11
EventPlayerGamemodeChangeEvent uint8 = 12
EventPlayerCustomPayloadEvent uint8 = 13
EventPlayerFishEvent uint8 = 14
EventPlayerEggThrowEvent uint8 = 15
EventPlayerInteractUnknownEntityEvent uint8 = 16
EventPlayerInteractEvent uint8 = 17
EventPlayerToggleSneakEvent uint8 = 18
EventPlayerToggleFlightEvent uint8 = 19
EventPlayerToggleSprintEvent uint8 = 20
EventInventoryClickEvent uint8 = 21
EventInventoryCloseEvent uint8 = 22
EventBlockRedstoneEvent uint8 = 23
EventBlockBreakEvent uint8 = 24
EventBlockBurnEvent uint8 = 25
EventBlockCanBuildEvent uint8 = 26
EventBlockGrowEvent uint8 = 27
EventBlockPlaceEvent uint8 = 28
EventServerCommandEvent uint8 = 29
EventSpawnChangeEvent uint8 = 30
EventServerBroadcastEvent uint8 = 31
)
type Event struct {
tag uint8
value any
}
func (self Event) Tag() uint8 {
return self.tag
}
func (self Event) PlayerJoinEvent() PlayerJoinEventData {
if self.tag != EventPlayerJoinEvent {
panic("tag mismatch")
}
return self.value.(PlayerJoinEventData)
}
func (self Event) PlayerLeaveEvent() PlayerLeaveEventData {
if self.tag != EventPlayerLeaveEvent {
panic("tag mismatch")
}
return self.value.(PlayerLeaveEventData)
}
func (self Event) PlayerLoginEvent() PlayerLoginEventData {
if self.tag != EventPlayerLoginEvent {
panic("tag mismatch")
}
return self.value.(PlayerLoginEventData)
}
func (self Event) PlayerChatEvent() PlayerChatEventData {
if self.tag != EventPlayerChatEvent {
panic("tag mismatch")
}
return self.value.(PlayerChatEventData)
}
func (self Event) PlayerCommandSendEvent() PlayerCommandSendEventData {
if self.tag != EventPlayerCommandSendEvent {
panic("tag mismatch")
}
return self.value.(PlayerCommandSendEventData)
}
func (self Event) PlayerPermissionCheckEvent() PlayerPermissionCheckEventData {
if self.tag != EventPlayerPermissionCheckEvent {
panic("tag mismatch")
}
return self.value.(PlayerPermissionCheckEventData)
}
func (self Event) PlayerMoveEvent() PlayerMoveEventData {
if self.tag != EventPlayerMoveEvent {
panic("tag mismatch")
}
return self.value.(PlayerMoveEventData)
}
func (self Event) PlayerTeleportEvent() PlayerTeleportEventData {
if self.tag != EventPlayerTeleportEvent {
panic("tag mismatch")
}
return self.value.(PlayerTeleportEventData)
}
func (self Event) PlayerChangeWorldEvent() PlayerChangeWorldEventData {
if self.tag != EventPlayerChangeWorldEvent {
panic("tag mismatch")
}
return self.value.(PlayerChangeWorldEventData)
}
func (self Event) PlayerExpChangeEvent() PlayerExpChangeEventData {
if self.tag != EventPlayerExpChangeEvent {
panic("tag mismatch")
}
return self.value.(PlayerExpChangeEventData)
}
func (self Event) PlayerItemHeldEvent() PlayerItemHeldEventData {
if self.tag != EventPlayerItemHeldEvent {
panic("tag mismatch")
}
return self.value.(PlayerItemHeldEventData)
}
func (self Event) PlayerChangedMainHandEvent() PlayerChangedMainHandEventData {
if self.tag != EventPlayerChangedMainHandEvent {
panic("tag mismatch")
}
return self.value.(PlayerChangedMainHandEventData)
}
func (self Event) PlayerGamemodeChangeEvent() PlayerGamemodeChangeEventData {
if self.tag != EventPlayerGamemodeChangeEvent {
panic("tag mismatch")
}
return self.value.(PlayerGamemodeChangeEventData)
}
func (self Event) PlayerCustomPayloadEvent() PlayerCustomPayloadEventData {
if self.tag != EventPlayerCustomPayloadEvent {
panic("tag mismatch")
}
return self.value.(PlayerCustomPayloadEventData)
}
func (self Event) PlayerFishEvent() PlayerFishEventData {
if self.tag != EventPlayerFishEvent {
panic("tag mismatch")
}
return self.value.(PlayerFishEventData)
}
func (self Event) PlayerEggThrowEvent() PlayerEggThrowEventData {
if self.tag != EventPlayerEggThrowEvent {
panic("tag mismatch")
}
return self.value.(PlayerEggThrowEventData)
}
func (self Event) PlayerInteractUnknownEntityEvent() PlayerInteractUnknownEntityEventData {
if self.tag != EventPlayerInteractUnknownEntityEvent {
panic("tag mismatch")
}
return self.value.(PlayerInteractUnknownEntityEventData)
}
func (self Event) PlayerInteractEvent() PlayerInteractEventData {
if self.tag != EventPlayerInteractEvent {
panic("tag mismatch")
}
return self.value.(PlayerInteractEventData)
}
func (self Event) PlayerToggleSneakEvent() PlayerToggleSneakEventData {
if self.tag != EventPlayerToggleSneakEvent {
panic("tag mismatch")
}
return self.value.(PlayerToggleSneakEventData)
}
func (self Event) PlayerToggleFlightEvent() PlayerToggleFlightEventData {
if self.tag != EventPlayerToggleFlightEvent {
panic("tag mismatch")
}
return self.value.(PlayerToggleFlightEventData)
}
func (self Event) PlayerToggleSprintEvent() PlayerToggleSprintEventData {
if self.tag != EventPlayerToggleSprintEvent {
panic("tag mismatch")
}
return self.value.(PlayerToggleSprintEventData)
}
func (self Event) InventoryClickEvent() InventoryClickEventData {
if self.tag != EventInventoryClickEvent {
panic("tag mismatch")
}
return self.value.(InventoryClickEventData)
}
func (self Event) InventoryCloseEvent() InventoryCloseEventData {
if self.tag != EventInventoryCloseEvent {
panic("tag mismatch")
}
return self.value.(InventoryCloseEventData)
}
func (self Event) BlockRedstoneEvent() BlockRedstoneEventData {
if self.tag != EventBlockRedstoneEvent {
panic("tag mismatch")
}
return self.value.(BlockRedstoneEventData)
}
func (self Event) BlockBreakEvent() BlockBreakEventData {
if self.tag != EventBlockBreakEvent {
panic("tag mismatch")
}
return self.value.(BlockBreakEventData)
}
func (self Event) BlockBurnEvent() BlockBurnEventData {
if self.tag != EventBlockBurnEvent {
panic("tag mismatch")
}
return self.value.(BlockBurnEventData)
}
func (self Event) BlockCanBuildEvent() BlockCanBuildEventData {
if self.tag != EventBlockCanBuildEvent {
panic("tag mismatch")
}
return self.value.(BlockCanBuildEventData)
}
func (self Event) BlockGrowEvent() BlockGrowEventData {
if self.tag != EventBlockGrowEvent {
panic("tag mismatch")
}
return self.value.(BlockGrowEventData)
}
func (self Event) BlockPlaceEvent() BlockPlaceEventData {
if self.tag != EventBlockPlaceEvent {
panic("tag mismatch")
}
return self.value.(BlockPlaceEventData)
}
func (self Event) ServerCommandEvent() ServerCommandEventData {
if self.tag != EventServerCommandEvent {
panic("tag mismatch")
}
return self.value.(ServerCommandEventData)
}
func (self Event) SpawnChangeEvent() SpawnChangeEventData {
if self.tag != EventSpawnChangeEvent {
panic("tag mismatch")
}
return self.value.(SpawnChangeEventData)
}
func (self Event) ServerBroadcastEvent() ServerBroadcastEventData {
if self.tag != EventServerBroadcastEvent {
panic("tag mismatch")
}
return self.value.(ServerBroadcastEventData)
}
func MakeEventPlayerJoinEvent(value PlayerJoinEventData) Event {
return Event{EventPlayerJoinEvent, value}
}
func MakeEventPlayerLeaveEvent(value PlayerLeaveEventData) Event {
return Event{EventPlayerLeaveEvent, value}
}
func MakeEventPlayerLoginEvent(value PlayerLoginEventData) Event {
return Event{EventPlayerLoginEvent, value}
}
func MakeEventPlayerChatEvent(value PlayerChatEventData) Event {
return Event{EventPlayerChatEvent, value}
}
func MakeEventPlayerCommandSendEvent(value PlayerCommandSendEventData) Event {
return Event{EventPlayerCommandSendEvent, value}
}
func MakeEventPlayerPermissionCheckEvent(value PlayerPermissionCheckEventData) Event {
return Event{EventPlayerPermissionCheckEvent, value}
}
func MakeEventPlayerMoveEvent(value PlayerMoveEventData) Event {
return Event{EventPlayerMoveEvent, value}
}
func MakeEventPlayerTeleportEvent(value PlayerTeleportEventData) Event {
return Event{EventPlayerTeleportEvent, value}
}
func MakeEventPlayerChangeWorldEvent(value PlayerChangeWorldEventData) Event {
return Event{EventPlayerChangeWorldEvent, value}
}
func MakeEventPlayerExpChangeEvent(value PlayerExpChangeEventData) Event {
return Event{EventPlayerExpChangeEvent, value}
}
func MakeEventPlayerItemHeldEvent(value PlayerItemHeldEventData) Event {
return Event{EventPlayerItemHeldEvent, value}
}
func MakeEventPlayerChangedMainHandEvent(value PlayerChangedMainHandEventData) Event {
return Event{EventPlayerChangedMainHandEvent, value}
}
func MakeEventPlayerGamemodeChangeEvent(value PlayerGamemodeChangeEventData) Event {
return Event{EventPlayerGamemodeChangeEvent, value}
}
func MakeEventPlayerCustomPayloadEvent(value PlayerCustomPayloadEventData) Event {
return Event{EventPlayerCustomPayloadEvent, value}
}
func MakeEventPlayerFishEvent(value PlayerFishEventData) Event {
return Event{EventPlayerFishEvent, value}
}
func MakeEventPlayerEggThrowEvent(value PlayerEggThrowEventData) Event {
return Event{EventPlayerEggThrowEvent, value}
}
func MakeEventPlayerInteractUnknownEntityEvent(value PlayerInteractUnknownEntityEventData) Event {
return Event{EventPlayerInteractUnknownEntityEvent, value}
}
func MakeEventPlayerInteractEvent(value PlayerInteractEventData) Event {
return Event{EventPlayerInteractEvent, value}
}
func MakeEventPlayerToggleSneakEvent(value PlayerToggleSneakEventData) Event {
return Event{EventPlayerToggleSneakEvent, value}
}
func MakeEventPlayerToggleFlightEvent(value PlayerToggleFlightEventData) Event {
return Event{EventPlayerToggleFlightEvent, value}
}
func MakeEventPlayerToggleSprintEvent(value PlayerToggleSprintEventData) Event {
return Event{EventPlayerToggleSprintEvent, value}
}
func MakeEventInventoryClickEvent(value InventoryClickEventData) Event {
return Event{EventInventoryClickEvent, value}
}
func MakeEventInventoryCloseEvent(value InventoryCloseEventData) Event {
return Event{EventInventoryCloseEvent, value}
}
func MakeEventBlockRedstoneEvent(value BlockRedstoneEventData) Event {
return Event{EventBlockRedstoneEvent, value}
}
func MakeEventBlockBreakEvent(value BlockBreakEventData) Event {
return Event{EventBlockBreakEvent, value}
}
func MakeEventBlockBurnEvent(value BlockBurnEventData) Event {
return Event{EventBlockBurnEvent, value}
}
func MakeEventBlockCanBuildEvent(value BlockCanBuildEventData) Event {
return Event{EventBlockCanBuildEvent, value}
}
func MakeEventBlockGrowEvent(value BlockGrowEventData) Event {
return Event{EventBlockGrowEvent, value}
}
func MakeEventBlockPlaceEvent(value BlockPlaceEventData) Event {
return Event{EventBlockPlaceEvent, value}
}
func MakeEventServerCommandEvent(value ServerCommandEventData) Event {
return Event{EventServerCommandEvent, value}
}
func MakeEventSpawnChangeEvent(value SpawnChangeEventData) Event {
return Event{EventSpawnChangeEvent, value}
}
func MakeEventServerBroadcastEvent(value ServerBroadcastEventData) Event {
return Event{EventServerBroadcastEvent, value}
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,240 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_gui
import (
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_common"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_text"
witRuntime "go.bytecodealliance.org/pkg/wit/runtime"
witTypes "go.bytecodealliance.org/pkg/wit/types"
"unsafe"
"runtime"
)
type TextComponent = pumpkin_plugin_text.TextComponent
type ItemStack = pumpkin_plugin_common.ItemStack
type ClickType = pumpkin_plugin_common.ClickType
const (
GuiTypeGeneric9x1 uint8 = 0
GuiTypeGeneric9x2 uint8 = 1
GuiTypeGeneric9x3 uint8 = 2
GuiTypeGeneric9x4 uint8 = 3
GuiTypeGeneric9x5 uint8 = 4
GuiTypeGeneric9x6 uint8 = 5
GuiTypeGeneric3x3 uint8 = 6
GuiTypeCrafter3x3 uint8 = 7
GuiTypeAnvil uint8 = 8
GuiTypeBeacon uint8 = 9
GuiTypeBlastFurnace uint8 = 10
GuiTypeBrewingStand uint8 = 11
GuiTypeCrafting uint8 = 12
GuiTypeEnchantment uint8 = 13
GuiTypeFurnace uint8 = 14
GuiTypeGrindstone uint8 = 15
GuiTypeHopper uint8 = 16
GuiTypeLectern uint8 = 17
GuiTypeLoom uint8 = 18
GuiTypeMerchant uint8 = 19
GuiTypeShulkerBox uint8 = 20
GuiTypeSmithing uint8 = 21
GuiTypeSmoker uint8 = 22
GuiTypeCartographyTable uint8 = 23
GuiTypeStonecutter uint8 = 24
)
type GuiType = uint8
//go:wasmimport pumpkin:plugin/gui@0.1.0 [resource-drop]gui
func resourceDropGui(handle int32)
type Gui struct {
handle *witRuntime.Handle
}
func (self *Gui) TakeHandle() int32 {
return self.handle.Take()
}
func (self *Gui) SetHandle(handle int32) {
self.handle.Set(handle)
}
func (self *Gui) Handle() int32 {
return self.handle.Use()
}
func (self *Gui) Drop() {
handle := self.handle.TakeOrNil()
if handle != 0 {
resourceDropGui(handle)
}
}
func GuiFromOwnHandle(handleValue int32) *Gui {
handle := witRuntime.MakeHandle(handleValue)
value := &Gui{handle}
runtime.AddCleanup(value, func(_ int) {
handleValue := handle.TakeOrNil()
if handleValue != 0 {
resourceDropGui(handleValue)
}
}, 0)
return value
}
func GuiFromBorrowHandle(handleValue int32) *Gui {
handle := witRuntime.MakeHandle(handleValue)
return &Gui{handle}
}
//go:wasmimport pumpkin:plugin/gui@0.1.0 [constructor]gui
func wasm_import_constructor_gui(arg0 int32, arg1 int32) int32
func MakeGui(guiType GuiType, title *pumpkin_plugin_text.TextComponent) *Gui {
result := wasm_import_constructor_gui(int32(guiType), (title).TakeHandle())
return GuiFromOwnHandle(int32(uintptr(result)))
}
//go:wasmimport pumpkin:plugin/gui@0.1.0 [method]gui.set-item
func wasm_import_method_gui_set_item(arg0 int32, arg1 int32, arg2 uintptr, arg3 uint32, arg4 int32)
func (self *Gui) SetItem(slot uint32, item pumpkin_plugin_common.ItemStack) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData((item).RegistryKey))
pinner.Pin(utf8)
wasm_import_method_gui_set_item((self).Handle(), int32(slot), uintptr(utf8), uint32(len((item).RegistryKey)), int32((item).Count))
}
//go:wasmimport pumpkin:plugin/gui@0.1.0 [method]gui.get-item
func wasm_import_method_gui_get_item(arg0 int32, arg1 int32, arg2 uintptr)
func (self *Gui) GetItem(slot uint32) witTypes.Option[pumpkin_plugin_common.ItemStack] {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (4*4), 4))
wasm_import_method_gui_get_item((self).Handle(), int32(slot), returnArea)
var option witTypes.Option[pumpkin_plugin_common.ItemStack]
switch uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))) {
case 0:
option = witTypes.None[pumpkin_plugin_common.ItemStack]()
case 1:
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (2*4))))
option = witTypes.Some[pumpkin_plugin_common.ItemStack](pumpkin_plugin_common.ItemStack{value, uint8(uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (3*4)))))})
default:
panic("unreachable")
}
result := option;
return result
}
//go:wasmimport pumpkin:plugin/gui@0.1.0 [method]gui.get-type
func wasm_import_method_gui_get_type(arg0 int32) int32
func (self *Gui) GetType() GuiType {
result := wasm_import_method_gui_get_type((self).Handle())
return uint8(result)
}
//go:wasmimport pumpkin:plugin/gui@0.1.0 [method]gui.get-title
func wasm_import_method_gui_get_title(arg0 int32) int32
func (self *Gui) GetTitle() *pumpkin_plugin_text.TextComponent {
result := wasm_import_method_gui_get_title((self).Handle())
return pumpkin_plugin_text.TextComponentFromOwnHandle(int32(uintptr(result)))
}
//go:wasmimport pumpkin:plugin/gui@0.1.0 [method]gui.get-size
func wasm_import_method_gui_get_size(arg0 int32) int32
func (self *Gui) GetSize() uint32 {
result := wasm_import_method_gui_get_size((self).Handle())
return uint32(result)
}
//go:wasmimport pumpkin:plugin/gui@0.1.0 [method]gui.clear-items
func wasm_import_method_gui_clear_items(arg0 int32)
func (self *Gui) ClearItems() {
wasm_import_method_gui_clear_items((self).Handle())
}
//go:wasmimport pumpkin:plugin/gui@0.1.0 [method]gui.set-allow-grab-items
func wasm_import_method_gui_set_allow_grab_items(arg0 int32, arg1 int32)
func (self *Gui) SetAllowGrabItems(allow bool) {
var result int32
if allow {
result = 1
} else {
result = 0
}
wasm_import_method_gui_set_allow_grab_items((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/gui@0.1.0 [method]gui.get-allow-grab-items
func wasm_import_method_gui_get_allow_grab_items(arg0 int32) int32
func (self *Gui) GetAllowGrabItems() bool {
result := wasm_import_method_gui_get_allow_grab_items((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/gui@0.1.0 [method]gui.set-allow-put-items
func wasm_import_method_gui_set_allow_put_items(arg0 int32, arg1 int32)
func (self *Gui) SetAllowPutItems(allow bool) {
var result int32
if allow {
result = 1
} else {
result = 0
}
wasm_import_method_gui_set_allow_put_items((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/gui@0.1.0 [method]gui.get-allow-put-items
func wasm_import_method_gui_get_allow_put_items(arg0 int32) int32
func (self *Gui) GetAllowPutItems() bool {
result := wasm_import_method_gui_get_allow_put_items((self).Handle())
return (result != 0)
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,47 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_i18n
import (
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_common"
witRuntime "go.bytecodealliance.org/pkg/wit/runtime"
"runtime"
"unsafe"
)
type Locale = pumpkin_plugin_common.Locale
//go:wasmimport pumpkin:plugin/i18n@0.1.0 translate
func wasm_import_translate(arg0 uintptr, arg1 uint32, arg2 int32, arg3 uintptr)
func Translate(key string, locale pumpkin_plugin_common.Locale) string {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
utf8 := unsafe.Pointer(unsafe.StringData(key))
pinner.Pin(utf8)
wasm_import_translate(uintptr(utf8), uint32(len(key)), int32(locale), returnArea)
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
result := value
return result
}
//go:wasmimport pumpkin:plugin/i18n@0.1.0 load-translations
func wasm_import_load_translations(arg0 uintptr, arg1 uint32, arg2 uintptr, arg3 uint32, arg4 int32)
func LoadTranslations(namespace string, json string, locale pumpkin_plugin_common.Locale) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(namespace))
pinner.Pin(utf8)
utf80 := unsafe.Pointer(unsafe.StringData(json))
pinner.Pin(utf80)
wasm_import_load_translations(uintptr(utf8), uint32(len(namespace)), uintptr(utf80), uint32(len(json)), int32(locale))
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,47 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_logging
import (
"runtime"
"unsafe"
)
const (
LevelTrace uint8 = 0
LevelDebug uint8 = 1
LevelInfo uint8 = 2
LevelWarn uint8 = 3
LevelError uint8 = 4
)
type Level = uint8
//go:wasmimport pumpkin:plugin/logging@0.1.0 log
func wasm_import_log(arg0 int32, arg1 uintptr, arg2 uint32)
func Log(level Level, message string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(message))
pinner.Pin(utf8)
wasm_import_log(int32(level), uintptr(utf8), uint32(len(message)))
}
//go:wasmimport pumpkin:plugin/logging@0.1.0 log-tracing
func wasm_import_log_tracing(arg0 uintptr, arg1 uint32)
func LogTracing(event []uint8) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
data := unsafe.Pointer(unsafe.SliceData(event))
pinner.Pin(data)
wasm_import_log_tracing(uintptr(data), uint32(len(event)))
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,21 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_metadata
import ()
type PluginMetadata struct {
// Name of the plugin.
Name string
// Plugin version (semver).
Version string
// Plugin authors.
Authors []string
// Short description of the plugin.
Description string
// Plugin dependencies.
Dependencies []string
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,81 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_permission
import ()
const (
PermissionLevelZero uint8 = 0
PermissionLevelOne uint8 = 1
PermissionLevelTwo uint8 = 2
PermissionLevelThree uint8 = 3
PermissionLevelFour uint8 = 4
)
// Represents the player's permission level
//
// Permission levels determine the player's access to commands and server operations.
// Each numeric level corresponds to a specific role:
// - `Zero`: `normal`: Player can use basic commands.
// - `One`: `moderator`: Player can bypass spawn protection.
// - `Two`: `gamemaster`: Player or executor can use more commands and player can use command blocks.
// - `Three`: `admin`: Player or executor can use commands related to multiplayer management.
// - `Four`: `owner`: Player or executor can use all of the commands, including commands related to server management.
type PermissionLevel = uint8
const (
// Permission is not granted by default
PermissionDefaultDeny uint8 = 0
// Permission is granted by default
PermissionDefaultAllow uint8 = 1
// Permission is granted by default to operators
PermissionDefaultOp uint8 = 2
)
// Describes the default behavior for permissions
type PermissionDefault struct {
tag uint8
value any
}
func (self PermissionDefault) Tag() uint8 {
return self.tag
}
func (self PermissionDefault) Op() PermissionLevel {
if self.tag != PermissionDefaultOp {
panic("tag mismatch")
}
return self.value.(PermissionLevel)
}
func MakePermissionDefaultDeny() PermissionDefault {
return PermissionDefault{PermissionDefaultDeny, nil}
}
func MakePermissionDefaultAllow() PermissionDefault {
return PermissionDefault{PermissionDefaultAllow, nil}
}
func MakePermissionDefaultOp(value PermissionLevel) PermissionDefault {
return PermissionDefault{PermissionDefaultOp, value}
}
// A child permission entry
type PermissionChild struct {
Node string
Value bool
}
// Defines a permission node in the system
type Permission struct {
// The full node name (e.g., "minecraft:command.gamemode")
Node string
// Description of what this permission does
Description string
// The default value of this permission
Default PermissionDefault
// Children nodes that are affected by this permission
Children []PermissionChild
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,998 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_player
import (
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_common"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_gui"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_permission"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_text"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_world"
witRuntime "go.bytecodealliance.org/pkg/wit/runtime"
witTypes "go.bytecodealliance.org/pkg/wit/types"
"runtime"
"unsafe"
)
type Hand = pumpkin_plugin_common.Hand
type ItemStack = pumpkin_plugin_common.ItemStack
type Position = witTypes.Tuple3[float64, float64, float64]
type GameMode = pumpkin_plugin_common.GameMode
type World = pumpkin_plugin_world.World
type Entity = pumpkin_plugin_world.Entity
type PermissionLevel = pumpkin_plugin_permission.PermissionLevel
type TextComponent = pumpkin_plugin_text.TextComponent
type Gui = pumpkin_plugin_gui.Gui
// Various abilities a player can have.
type PlayerAbilities struct {
// Whether the player is invulnerable to damage.
Invulnerable bool
// Whether the player is currently flying.
Flying bool
// Whether the player is allowed to fly.
AllowFlying bool
// Whether the player is in creative mode.
Creative bool
// Whether the player can modify the world.
AllowModifyWorld bool
// The speed at which the player flies.
FlySpeed float32
// The speed at which the player walks.
WalkSpeed float32
}
// Represents a player's skin textures and metadata.
type PlayerSkin struct {
// The base64-encoded texture data (usually JSON containing skin/cape URLs).
Value string
// The optional signature for the texture data.
Signature witTypes.Option[string]
}
const (
SkinPartsCape uint8 = 1 << 0
SkinPartsJacket uint8 = 1 << 1
SkinPartsLeftSleeve uint8 = 1 << 2
SkinPartsRightSleeve uint8 = 1 << 3
SkinPartsLeftPantsLeg uint8 = 1 << 4
SkinPartsRightPantsLeg uint8 = 1 << 5
SkinPartsHat uint8 = 1 << 6
)
// Flags representing visible skin parts.
type SkinParts = uint8
//go:wasmimport pumpkin:plugin/player@0.1.0 [resource-drop]player
func resourceDropPlayer(handle int32)
// A handle to a player on the server.
type Player struct {
handle *witRuntime.Handle
}
func (self *Player) TakeHandle() int32 {
return self.handle.Take()
}
func (self *Player) SetHandle(handle int32) {
self.handle.Set(handle)
}
func (self *Player) Handle() int32 {
return self.handle.Use()
}
func (self *Player) Drop() {
handle := self.handle.TakeOrNil()
if handle != 0 {
resourceDropPlayer(handle)
}
}
func PlayerFromOwnHandle(handleValue int32) *Player {
handle := witRuntime.MakeHandle(handleValue)
value := &Player{handle}
runtime.AddCleanup(value, func(_ int) {
handleValue := handle.TakeOrNil()
if handleValue != 0 {
resourceDropPlayer(handleValue)
}
}, 0)
return value
}
func PlayerFromBorrowHandle(handleValue int32) *Player {
handle := witRuntime.MakeHandle(handleValue)
return &Player{handle}
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.as-entity
func wasm_import_method_player_as_entity(arg0 int32) int32
func (self *Player) AsEntity() *pumpkin_plugin_world.Entity {
result := wasm_import_method_player_as_entity((self).Handle())
return pumpkin_plugin_world.EntityFromOwnHandle(int32(uintptr(result)))
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-id
func wasm_import_method_player_get_id(arg0 int32, arg1 uintptr)
func (self *Player) GetId() string {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_player_get_id((self).Handle(), returnArea)
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
result := value
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-name
func wasm_import_method_player_get_name(arg0 int32, arg1 uintptr)
func (self *Player) GetName() string {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_player_get_name((self).Handle(), returnArea)
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
result := value
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-position
func wasm_import_method_player_get_position(arg0 int32, arg1 uintptr)
func (self *Player) GetPosition() witTypes.Tuple3[float64, float64, float64] {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, 24, 8))
wasm_import_method_player_get_position((self).Handle(), returnArea)
result := witTypes.Tuple3[float64, float64, float64]{*(*float64)(unsafe.Add(unsafe.Pointer(returnArea), 0)), *(*float64)(unsafe.Add(unsafe.Pointer(returnArea), 8)), *(*float64)(unsafe.Add(unsafe.Pointer(returnArea), 16))}
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-yaw
func wasm_import_method_player_get_yaw(arg0 int32) float32
func (self *Player) GetYaw() float32 {
result := wasm_import_method_player_get_yaw((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-pitch
func wasm_import_method_player_get_pitch(arg0 int32) float32
func (self *Player) GetPitch() float32 {
result := wasm_import_method_player_get_pitch((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-world
func wasm_import_method_player_get_world(arg0 int32) int32
func (self *Player) GetWorld() *pumpkin_plugin_world.World {
result := wasm_import_method_player_get_world((self).Handle())
return pumpkin_plugin_world.WorldFromOwnHandle(int32(uintptr(result)))
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-gamemode
func wasm_import_method_player_get_gamemode(arg0 int32) int32
func (self *Player) GetGamemode() pumpkin_plugin_common.GameMode {
result := wasm_import_method_player_get_gamemode((self).Handle())
return uint8(result)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-gamemode
func wasm_import_method_player_set_gamemode(arg0 int32, arg1 int32) int32
func (self *Player) SetGamemode(mode pumpkin_plugin_common.GameMode) bool {
result := wasm_import_method_player_set_gamemode((self).Handle(), int32(mode))
return (result != 0)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-locale
func wasm_import_method_player_get_locale(arg0 int32, arg1 uintptr)
func (self *Player) GetLocale() string {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_player_get_locale((self).Handle(), returnArea)
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
result := value
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-ping
func wasm_import_method_player_get_ping(arg0 int32) int32
func (self *Player) GetPing() uint32 {
result := wasm_import_method_player_get_ping((self).Handle())
return uint32(result)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-permission-level
func wasm_import_method_player_get_permission_level(arg0 int32) int32
func (self *Player) GetPermissionLevel() pumpkin_plugin_permission.PermissionLevel {
result := wasm_import_method_player_get_permission_level((self).Handle())
return uint8(result)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-permission-level
func wasm_import_method_player_set_permission_level(arg0 int32, arg1 int32)
func (self *Player) SetPermissionLevel(level pumpkin_plugin_permission.PermissionLevel) {
wasm_import_method_player_set_permission_level((self).Handle(), int32(level))
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-permission
func wasm_import_method_player_set_permission(arg0 int32, arg1 uintptr, arg2 uint32, arg3 int32)
func (self *Player) SetPermission(node string, value bool) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(node))
pinner.Pin(utf8)
var result int32
if value {
result = 1
} else {
result = 0
}
wasm_import_method_player_set_permission((self).Handle(), uintptr(utf8), uint32(len(node)), result)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.unset-permission
func wasm_import_method_player_unset_permission(arg0 int32, arg1 uintptr, arg2 uint32)
func (self *Player) UnsetPermission(node string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(node))
pinner.Pin(utf8)
wasm_import_method_player_unset_permission((self).Handle(), uintptr(utf8), uint32(len(node)))
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.has-permission-set
func wasm_import_method_player_has_permission_set(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr)
func (self *Player) HasPermissionSet(node string) witTypes.Option[bool] {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, 2, 1))
utf8 := unsafe.Pointer(unsafe.StringData(node))
pinner.Pin(utf8)
wasm_import_method_player_has_permission_set((self).Handle(), uintptr(utf8), uint32(len(node)), returnArea)
var option witTypes.Option[bool]
switch uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))) {
case 0:
option = witTypes.None[bool]()
case 1:
option = witTypes.Some[bool]((uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 1))) != 0))
default:
panic("unreachable")
}
result := option
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.has-permission
func wasm_import_method_player_has_permission(arg0 int32, arg1 uintptr, arg2 uint32) int32
func (self *Player) HasPermission(node string) bool {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(node))
pinner.Pin(utf8)
result := wasm_import_method_player_has_permission((self).Handle(), uintptr(utf8), uint32(len(node)))
return (result != 0)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-display-name
func wasm_import_method_player_get_display_name(arg0 int32) int32
func (self *Player) GetDisplayName() *pumpkin_plugin_text.TextComponent {
result := wasm_import_method_player_get_display_name((self).Handle())
return pumpkin_plugin_text.TextComponentFromOwnHandle(int32(uintptr(result)))
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-display-name
func wasm_import_method_player_set_display_name(arg0 int32, arg1 int32)
func (self *Player) SetDisplayName(displayName *pumpkin_plugin_text.TextComponent) {
wasm_import_method_player_set_display_name((self).Handle(), (displayName).TakeHandle())
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.send-system-message
func wasm_import_method_player_send_system_message(arg0 int32, arg1 int32, arg2 int32)
func (self *Player) SendSystemMessage(text *pumpkin_plugin_text.TextComponent, overlay bool) {
var result int32
if overlay {
result = 1
} else {
result = 0
}
wasm_import_method_player_send_system_message((self).Handle(), (text).TakeHandle(), result)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-tab-list-header-footer
func wasm_import_method_player_set_tab_list_header_footer(arg0 int32, arg1 int32, arg2 int32)
func (self *Player) SetTabListHeaderFooter(header *pumpkin_plugin_text.TextComponent, footer *pumpkin_plugin_text.TextComponent) {
wasm_import_method_player_set_tab_list_header_footer((self).Handle(), (header).TakeHandle(), (footer).TakeHandle())
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-tab-list-order
func wasm_import_method_player_set_tab_list_order(arg0 int32, arg1 int32)
func (self *Player) SetTabListOrder(order int32) {
wasm_import_method_player_set_tab_list_order((self).Handle(), order)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-tab-list-latency
func wasm_import_method_player_set_tab_list_latency(arg0 int32, arg1 int32)
func (self *Player) SetTabListLatency(latency int32) {
wasm_import_method_player_set_tab_list_latency((self).Handle(), latency)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-tab-list-listed
func wasm_import_method_player_set_tab_list_listed(arg0 int32, arg1 int32)
func (self *Player) SetTabListListed(listed bool) {
var result int32
if listed {
result = 1
} else {
result = 0
}
wasm_import_method_player_set_tab_list_listed((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.show-title
func wasm_import_method_player_show_title(arg0 int32, arg1 int32)
func (self *Player) ShowTitle(text *pumpkin_plugin_text.TextComponent) {
wasm_import_method_player_show_title((self).Handle(), (text).TakeHandle())
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.show-subtitle
func wasm_import_method_player_show_subtitle(arg0 int32, arg1 int32)
func (self *Player) ShowSubtitle(text *pumpkin_plugin_text.TextComponent) {
wasm_import_method_player_show_subtitle((self).Handle(), (text).TakeHandle())
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.show-actionbar
func wasm_import_method_player_show_actionbar(arg0 int32, arg1 int32)
func (self *Player) ShowActionbar(text *pumpkin_plugin_text.TextComponent) {
wasm_import_method_player_show_actionbar((self).Handle(), (text).TakeHandle())
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.send-title-animation
func wasm_import_method_player_send_title_animation(arg0 int32, arg1 int32, arg2 int32, arg3 int32)
func (self *Player) SendTitleAnimation(fadeIn int32, stay int32, fadeOut int32) {
wasm_import_method_player_send_title_animation((self).Handle(), fadeIn, stay, fadeOut)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.teleport
func wasm_import_method_player_teleport(arg0 int32, arg1 float64, arg2 float64, arg3 float64, arg4 int32, arg5 float32, arg6 int32, arg7 float32, arg8 int32)
func (self *Player) Teleport(position witTypes.Tuple3[float64, float64, float64], yaw witTypes.Option[float32], pitch witTypes.Option[float32], world *pumpkin_plugin_world.World) {
var option int32
var option0 float32
switch yaw.Tag() {
case witTypes.OptionNone:
option = int32(0)
option0 = 0
case witTypes.OptionSome:
payload := yaw.Some()
option = int32(1)
option0 = payload
default:
panic("unreachable")
}
var option1 int32
var option2 float32
switch pitch.Tag() {
case witTypes.OptionNone:
option1 = int32(0)
option2 = 0
case witTypes.OptionSome:
payload := pitch.Some()
option1 = int32(1)
option2 = payload
default:
panic("unreachable")
}
wasm_import_method_player_teleport((self).Handle(), (position).F0, (position).F1, (position).F2, option, option0, option1, option2, (world).TakeHandle())
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.teleport-world
func wasm_import_method_player_teleport_world(arg0 int32, arg1 int32, arg2 float64, arg3 float64, arg4 float64, arg5 int32, arg6 float32, arg7 int32, arg8 float32)
func (self *Player) TeleportWorld(worldRef *pumpkin_plugin_world.World, position witTypes.Tuple3[float64, float64, float64], yaw witTypes.Option[float32], pitch witTypes.Option[float32]) {
var option int32
var option0 float32
switch yaw.Tag() {
case witTypes.OptionNone:
option = int32(0)
option0 = 0
case witTypes.OptionSome:
payload := yaw.Some()
option = int32(1)
option0 = payload
default:
panic("unreachable")
}
var option1 int32
var option2 float32
switch pitch.Tag() {
case witTypes.OptionNone:
option1 = int32(0)
option2 = 0
case witTypes.OptionSome:
payload := pitch.Some()
option1 = int32(1)
option2 = payload
default:
panic("unreachable")
}
wasm_import_method_player_teleport_world((self).Handle(), (worldRef).TakeHandle(), (position).F0, (position).F1, (position).F2, option, option0, option1, option2)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.kick
func wasm_import_method_player_kick(arg0 int32, arg1 int32)
func (self *Player) Kick(message *pumpkin_plugin_text.TextComponent) {
wasm_import_method_player_kick((self).Handle(), (message).TakeHandle())
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.respawn
func wasm_import_method_player_respawn(arg0 int32)
func (self *Player) Respawn() {
wasm_import_method_player_respawn((self).Handle())
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.open-gui
func wasm_import_method_player_open_gui(arg0 int32, arg1 int32)
func (self *Player) OpenGui(guiRef *pumpkin_plugin_gui.Gui) {
wasm_import_method_player_open_gui((self).Handle(), (guiRef).TakeHandle())
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.ban
func wasm_import_method_player_ban(arg0 int32, arg1 int32, arg2 int32)
func (self *Player) Ban(reason witTypes.Option[*pumpkin_plugin_text.TextComponent]) {
var option int32
var option0 int32
switch reason.Tag() {
case witTypes.OptionNone:
option = int32(0)
option0 = 0
case witTypes.OptionSome:
payload := reason.Some()
option = int32(1)
option0 = (payload).TakeHandle()
default:
panic("unreachable")
}
wasm_import_method_player_ban((self).Handle(), option, option0)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.ban-ip
func wasm_import_method_player_ban_ip(arg0 int32, arg1 int32, arg2 int32)
func (self *Player) BanIp(reason witTypes.Option[*pumpkin_plugin_text.TextComponent]) {
var option int32
var option0 int32
switch reason.Tag() {
case witTypes.OptionNone:
option = int32(0)
option0 = 0
case witTypes.OptionSome:
payload := reason.Some()
option = int32(1)
option0 = (payload).TakeHandle()
default:
panic("unreachable")
}
wasm_import_method_player_ban_ip((self).Handle(), option, option0)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-selected-slot
func wasm_import_method_player_get_selected_slot(arg0 int32) int32
func (self *Player) GetSelectedSlot() uint8 {
result := wasm_import_method_player_get_selected_slot((self).Handle())
return uint8(result)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-item-in-hand
func wasm_import_method_player_get_item_in_hand(arg0 int32, arg1 int32, arg2 uintptr)
func (self *Player) GetItemInHand(hand pumpkin_plugin_common.Hand) witTypes.Option[pumpkin_plugin_common.ItemStack] {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (4 * 4), 4))
wasm_import_method_player_get_item_in_hand((self).Handle(), int32(hand), returnArea)
var option witTypes.Option[pumpkin_plugin_common.ItemStack]
switch uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))) {
case 0:
option = witTypes.None[pumpkin_plugin_common.ItemStack]()
case 1:
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (2 * 4))))
option = witTypes.Some[pumpkin_plugin_common.ItemStack](pumpkin_plugin_common.ItemStack{value, uint8(uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (3 * 4)))))})
default:
panic("unreachable")
}
result := option
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-inventory-item
func wasm_import_method_player_get_inventory_item(arg0 int32, arg1 int32, arg2 uintptr)
func (self *Player) GetInventoryItem(slot uint8) witTypes.Option[pumpkin_plugin_common.ItemStack] {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (4 * 4), 4))
wasm_import_method_player_get_inventory_item((self).Handle(), int32(slot), returnArea)
var option witTypes.Option[pumpkin_plugin_common.ItemStack]
switch uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))) {
case 0:
option = witTypes.None[pumpkin_plugin_common.ItemStack]()
case 1:
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (2 * 4))))
option = witTypes.Some[pumpkin_plugin_common.ItemStack](pumpkin_plugin_common.ItemStack{value, uint8(uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (3 * 4)))))})
default:
panic("unreachable")
}
result := option
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-health
func wasm_import_method_player_get_health(arg0 int32) float32
func (self *Player) GetHealth() float32 {
result := wasm_import_method_player_get_health((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-health
func wasm_import_method_player_set_health(arg0 int32, arg1 float32)
func (self *Player) SetHealth(health float32) {
wasm_import_method_player_set_health((self).Handle(), health)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-max-health
func wasm_import_method_player_get_max_health(arg0 int32) float32
func (self *Player) GetMaxHealth() float32 {
result := wasm_import_method_player_get_max_health((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-max-health
func wasm_import_method_player_set_max_health(arg0 int32, arg1 float32)
func (self *Player) SetMaxHealth(maxHealth float32) {
wasm_import_method_player_set_max_health((self).Handle(), maxHealth)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-food-level
func wasm_import_method_player_get_food_level(arg0 int32) int32
func (self *Player) GetFoodLevel() uint8 {
result := wasm_import_method_player_get_food_level((self).Handle())
return uint8(result)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-food-level
func wasm_import_method_player_set_food_level(arg0 int32, arg1 int32)
func (self *Player) SetFoodLevel(foodLevel uint8) {
wasm_import_method_player_set_food_level((self).Handle(), int32(foodLevel))
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-saturation
func wasm_import_method_player_get_saturation(arg0 int32) float32
func (self *Player) GetSaturation() float32 {
result := wasm_import_method_player_get_saturation((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-saturation
func wasm_import_method_player_set_saturation(arg0 int32, arg1 float32)
func (self *Player) SetSaturation(saturation float32) {
wasm_import_method_player_set_saturation((self).Handle(), saturation)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-exhaustion
func wasm_import_method_player_get_exhaustion(arg0 int32) float32
func (self *Player) GetExhaustion() float32 {
result := wasm_import_method_player_get_exhaustion((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-exhaustion
func wasm_import_method_player_set_exhaustion(arg0 int32, arg1 float32)
func (self *Player) SetExhaustion(exhaustion float32) {
wasm_import_method_player_set_exhaustion((self).Handle(), exhaustion)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-absorption
func wasm_import_method_player_get_absorption(arg0 int32) float32
func (self *Player) GetAbsorption() float32 {
result := wasm_import_method_player_get_absorption((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-absorption
func wasm_import_method_player_set_absorption(arg0 int32, arg1 float32)
func (self *Player) SetAbsorption(absorption float32) {
wasm_import_method_player_set_absorption((self).Handle(), absorption)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-experience-level
func wasm_import_method_player_get_experience_level(arg0 int32) int32
func (self *Player) GetExperienceLevel() int32 {
result := wasm_import_method_player_get_experience_level((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-experience-progress
func wasm_import_method_player_get_experience_progress(arg0 int32) float32
func (self *Player) GetExperienceProgress() float32 {
result := wasm_import_method_player_get_experience_progress((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-experience-points
func wasm_import_method_player_get_experience_points(arg0 int32) int32
func (self *Player) GetExperiencePoints() int32 {
result := wasm_import_method_player_get_experience_points((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-experience-level
func wasm_import_method_player_set_experience_level(arg0 int32, arg1 int32)
func (self *Player) SetExperienceLevel(level int32) {
wasm_import_method_player_set_experience_level((self).Handle(), level)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-experience-progress
func wasm_import_method_player_set_experience_progress(arg0 int32, arg1 float32)
func (self *Player) SetExperienceProgress(progress float32) {
wasm_import_method_player_set_experience_progress((self).Handle(), progress)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-experience-points
func wasm_import_method_player_set_experience_points(arg0 int32, arg1 int32)
func (self *Player) SetExperiencePoints(points int32) {
wasm_import_method_player_set_experience_points((self).Handle(), points)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.add-experience-levels
func wasm_import_method_player_add_experience_levels(arg0 int32, arg1 int32)
func (self *Player) AddExperienceLevels(levels int32) {
wasm_import_method_player_add_experience_levels((self).Handle(), levels)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.add-experience-points
func wasm_import_method_player_add_experience_points(arg0 int32, arg1 int32)
func (self *Player) AddExperiencePoints(points int32) {
wasm_import_method_player_add_experience_points((self).Handle(), points)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.is-flying
func wasm_import_method_player_is_flying(arg0 int32) int32
func (self *Player) IsFlying() bool {
result := wasm_import_method_player_is_flying((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-flying
func wasm_import_method_player_set_flying(arg0 int32, arg1 int32)
func (self *Player) SetFlying(flying bool) {
var result int32
if flying {
result = 1
} else {
result = 0
}
wasm_import_method_player_set_flying((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-abilities
func wasm_import_method_player_get_abilities(arg0 int32, arg1 uintptr)
func (self *Player) GetAbilities() PlayerAbilities {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, 16, 4))
wasm_import_method_player_get_abilities((self).Handle(), returnArea)
result := PlayerAbilities{(uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))) != 0), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 1))) != 0), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 2))) != 0), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 3))) != 0), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4))) != 0), *(*float32)(unsafe.Add(unsafe.Pointer(returnArea), 8)), *(*float32)(unsafe.Add(unsafe.Pointer(returnArea), 12))}
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-abilities
func wasm_import_method_player_set_abilities(arg0 int32, arg1 int32, arg2 int32, arg3 int32, arg4 int32, arg5 int32, arg6 float32, arg7 float32)
func (self *Player) SetAbilities(abilities PlayerAbilities) {
var result int32
if (abilities).Invulnerable {
result = 1
} else {
result = 0
}
var result0 int32
if (abilities).Flying {
result0 = 1
} else {
result0 = 0
}
var result1 int32
if (abilities).AllowFlying {
result1 = 1
} else {
result1 = 0
}
var result2 int32
if (abilities).Creative {
result2 = 1
} else {
result2 = 0
}
var result3 int32
if (abilities).AllowModifyWorld {
result3 = 1
} else {
result3 = 0
}
wasm_import_method_player_set_abilities((self).Handle(), result, result0, result1, result2, result3, (abilities).FlySpeed, (abilities).WalkSpeed)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-ip
func wasm_import_method_player_get_ip(arg0 int32, arg1 uintptr)
func (self *Player) GetIp() string {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_player_get_ip((self).Handle(), returnArea)
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
result := value
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-skin
func wasm_import_method_player_get_skin(arg0 int32, arg1 uintptr)
func (self *Player) GetSkin() witTypes.Option[PlayerSkin] {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (6 * 4), 4))
wasm_import_method_player_get_skin((self).Handle(), returnArea)
var option1 witTypes.Option[PlayerSkin]
switch uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))) {
case 0:
option1 = witTypes.None[PlayerSkin]()
case 1:
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (2 * 4))))
var option witTypes.Option[string]
switch uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (3 * 4)))) {
case 0:
option = witTypes.None[string]()
case 1:
value0 := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (4 * 4)))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (5 * 4))))
option = witTypes.Some[string](value0)
default:
panic("unreachable")
}
option1 = witTypes.Some[PlayerSkin](PlayerSkin{value, option})
default:
panic("unreachable")
}
result := option1
return result
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.get-skin-parts
func wasm_import_method_player_get_skin_parts(arg0 int32) int32
func (self *Player) GetSkinParts() SkinParts {
result := wasm_import_method_player_get_skin_parts((self).Handle())
return uint8(result)
}
//go:wasmimport pumpkin:plugin/player@0.1.0 [method]player.set-skin-parts
func wasm_import_method_player_set_skin_parts(arg0 int32, arg1 int32)
func (self *Player) SetSkinParts(parts SkinParts) {
wasm_import_method_player_set_skin_parts((self).Handle(), int32(parts))
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,37 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_scheduler
import ()
//go:wasmimport pumpkin:plugin/scheduler@0.1.0 schedule-delayed-task
func wasm_import_schedule_delayed_task(arg0 int32, arg1 int64) int32
func ScheduleDelayedTask(handlerId uint32, delayTicks uint64) uint32 {
result := wasm_import_schedule_delayed_task(int32(handlerId), int64(delayTicks))
return uint32(result)
}
//go:wasmimport pumpkin:plugin/scheduler@0.1.0 schedule-repeating-task
func wasm_import_schedule_repeating_task(arg0 int32, arg1 int64, arg2 int64) int32
func ScheduleRepeatingTask(handlerId uint32, delayTicks uint64, periodTicks uint64) uint32 {
result := wasm_import_schedule_repeating_task(int32(handlerId), int64(delayTicks), int64(periodTicks))
return uint32(result)
}
//go:wasmimport pumpkin:plugin/scheduler@0.1.0 cancel-task
func wasm_import_cancel_task(arg0 int32)
func CancelTask(taskId uint32) {
wasm_import_cancel_task(int32(taskId))
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,282 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_scoreboard
import (
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_common"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_text"
witRuntime "go.bytecodealliance.org/pkg/wit/runtime"
"runtime"
"unsafe"
)
type TextComponent = pumpkin_plugin_text.TextComponent
type NamedColor = pumpkin_plugin_common.NamedColor
const (
RenderTypeInteger uint8 = 0
RenderTypeHearts uint8 = 1
)
type RenderType = uint8
const (
DisplaySlotPlayerList uint8 = 0
DisplaySlotSidebar uint8 = 1
DisplaySlotBelowName uint8 = 2
DisplaySlotSidebarTeamBlack uint8 = 3
DisplaySlotSidebarTeamDarkBlue uint8 = 4
DisplaySlotSidebarTeamDarkGreen uint8 = 5
DisplaySlotSidebarTeamDarkAqua uint8 = 6
DisplaySlotSidebarTeamDarkRed uint8 = 7
DisplaySlotSidebarTeamDarkPurple uint8 = 8
DisplaySlotSidebarTeamGold uint8 = 9
DisplaySlotSidebarTeamGray uint8 = 10
DisplaySlotSidebarTeamDarkGray uint8 = 11
DisplaySlotSidebarTeamBlue uint8 = 12
DisplaySlotSidebarTeamGreen uint8 = 13
DisplaySlotSidebarTeamAqua uint8 = 14
DisplaySlotSidebarTeamRed uint8 = 15
DisplaySlotSidebarTeamLightPurple uint8 = 16
DisplaySlotSidebarTeamYellow uint8 = 17
DisplaySlotSidebarTeamWhite uint8 = 18
)
type DisplaySlot = uint8
const (
NametagVisibilityAlways uint8 = 0
NametagVisibilityNever uint8 = 1
NametagVisibilityHideForOtherTeams uint8 = 2
NametagVisibilityHideForOwnTeam uint8 = 3
)
type NametagVisibility = uint8
const (
CollisionRuleAlways uint8 = 0
CollisionRuleNever uint8 = 1
CollisionRulePushOtherTeams uint8 = 2
CollisionRulePushOwnTeam uint8 = 3
)
type CollisionRule = uint8
type TeamSettings struct {
DisplayName *pumpkin_plugin_text.TextComponent
FriendlyFire bool
SeeFriendlyInvisibles bool
NametagVisibility NametagVisibility
CollisionRule CollisionRule
Color pumpkin_plugin_common.NamedColor
Prefix *pumpkin_plugin_text.TextComponent
Suffix *pumpkin_plugin_text.TextComponent
}
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [resource-drop]scoreboard
func resourceDropScoreboard(handle int32)
type Scoreboard struct {
handle *witRuntime.Handle
}
func (self *Scoreboard) TakeHandle() int32 {
return self.handle.Take()
}
func (self *Scoreboard) SetHandle(handle int32) {
self.handle.Set(handle)
}
func (self *Scoreboard) Handle() int32 {
return self.handle.Use()
}
func (self *Scoreboard) Drop() {
handle := self.handle.TakeOrNil()
if handle != 0 {
resourceDropScoreboard(handle)
}
}
func ScoreboardFromOwnHandle(handleValue int32) *Scoreboard {
handle := witRuntime.MakeHandle(handleValue)
value := &Scoreboard{handle}
runtime.AddCleanup(value, func(_ int) {
handleValue := handle.TakeOrNil()
if handleValue != 0 {
resourceDropScoreboard(handleValue)
}
}, 0)
return value
}
func ScoreboardFromBorrowHandle(handleValue int32) *Scoreboard {
handle := witRuntime.MakeHandle(handleValue)
return &Scoreboard{handle}
}
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.add-objective
func wasm_import_method_scoreboard_add_objective(arg0 int32, arg1 uintptr, arg2 uint32, arg3 int32, arg4 int32)
func (self *Scoreboard) AddObjective(name string, displayName *pumpkin_plugin_text.TextComponent, renderType RenderType) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(name))
pinner.Pin(utf8)
wasm_import_method_scoreboard_add_objective((self).Handle(), uintptr(utf8), uint32(len(name)), (displayName).TakeHandle(), int32(renderType))
}
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.remove-objective
func wasm_import_method_scoreboard_remove_objective(arg0 int32, arg1 uintptr, arg2 uint32)
func (self *Scoreboard) RemoveObjective(name string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(name))
pinner.Pin(utf8)
wasm_import_method_scoreboard_remove_objective((self).Handle(), uintptr(utf8), uint32(len(name)))
}
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.set-display-slot
func wasm_import_method_scoreboard_set_display_slot(arg0 int32, arg1 int32, arg2 uintptr, arg3 uint32)
func (self *Scoreboard) SetDisplaySlot(slot DisplaySlot, objectiveName string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(objectiveName))
pinner.Pin(utf8)
wasm_import_method_scoreboard_set_display_slot((self).Handle(), int32(slot), uintptr(utf8), uint32(len(objectiveName)))
}
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.update-score
func wasm_import_method_scoreboard_update_score(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr, arg4 uint32, arg5 int32)
func (self *Scoreboard) UpdateScore(entityName string, objectiveName string, value int32) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(entityName))
pinner.Pin(utf8)
utf80 := unsafe.Pointer(unsafe.StringData(objectiveName))
pinner.Pin(utf80)
wasm_import_method_scoreboard_update_score((self).Handle(), uintptr(utf8), uint32(len(entityName)), uintptr(utf80), uint32(len(objectiveName)), value)
}
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.remove-score
func wasm_import_method_scoreboard_remove_score(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr, arg4 uint32)
func (self *Scoreboard) RemoveScore(entityName string, objectiveName string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(entityName))
pinner.Pin(utf8)
utf80 := unsafe.Pointer(unsafe.StringData(objectiveName))
pinner.Pin(utf80)
wasm_import_method_scoreboard_remove_score((self).Handle(), uintptr(utf8), uint32(len(entityName)), uintptr(utf80), uint32(len(objectiveName)))
}
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.create-team
func wasm_import_method_scoreboard_create_team(arg0 int32, arg1 uintptr, arg2 uint32, arg3 int32, arg4 int32, arg5 int32, arg6 int32, arg7 int32, arg8 int32, arg9 int32, arg10 int32)
func (self *Scoreboard) CreateTeam(name string, settings TeamSettings) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(name))
pinner.Pin(utf8)
var result int32
if (settings).FriendlyFire {
result = 1
} else {
result = 0
}
var result0 int32
if (settings).SeeFriendlyInvisibles {
result0 = 1
} else {
result0 = 0
}
wasm_import_method_scoreboard_create_team((self).Handle(), uintptr(utf8), uint32(len(name)), ((settings).DisplayName).TakeHandle(), result, result0, int32((settings).NametagVisibility), int32((settings).CollisionRule), int32((settings).Color), ((settings).Prefix).TakeHandle(), ((settings).Suffix).TakeHandle())
}
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.remove-team
func wasm_import_method_scoreboard_remove_team(arg0 int32, arg1 uintptr, arg2 uint32)
func (self *Scoreboard) RemoveTeam(name string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(name))
pinner.Pin(utf8)
wasm_import_method_scoreboard_remove_team((self).Handle(), uintptr(utf8), uint32(len(name)))
}
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.update-team
func wasm_import_method_scoreboard_update_team(arg0 int32, arg1 uintptr, arg2 uint32, arg3 int32, arg4 int32, arg5 int32, arg6 int32, arg7 int32, arg8 int32, arg9 int32, arg10 int32)
func (self *Scoreboard) UpdateTeam(name string, settings TeamSettings) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(name))
pinner.Pin(utf8)
var result int32
if (settings).FriendlyFire {
result = 1
} else {
result = 0
}
var result0 int32
if (settings).SeeFriendlyInvisibles {
result0 = 1
} else {
result0 = 0
}
wasm_import_method_scoreboard_update_team((self).Handle(), uintptr(utf8), uint32(len(name)), ((settings).DisplayName).TakeHandle(), result, result0, int32((settings).NametagVisibility), int32((settings).CollisionRule), int32((settings).Color), ((settings).Prefix).TakeHandle(), ((settings).Suffix).TakeHandle())
}
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.add-player-to-team
func wasm_import_method_scoreboard_add_player_to_team(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr, arg4 uint32)
func (self *Scoreboard) AddPlayerToTeam(teamName string, playerName string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(teamName))
pinner.Pin(utf8)
utf80 := unsafe.Pointer(unsafe.StringData(playerName))
pinner.Pin(utf80)
wasm_import_method_scoreboard_add_player_to_team((self).Handle(), uintptr(utf8), uint32(len(teamName)), uintptr(utf80), uint32(len(playerName)))
}
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.remove-player-from-team
func wasm_import_method_scoreboard_remove_player_from_team(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr, arg4 uint32)
func (self *Scoreboard) RemovePlayerFromTeam(teamName string, playerName string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(teamName))
pinner.Pin(utf8)
utf80 := unsafe.Pointer(unsafe.StringData(playerName))
pinner.Pin(utf80)
wasm_import_method_scoreboard_remove_player_from_team((self).Handle(), uintptr(utf8), uint32(len(teamName)), uintptr(utf80), uint32(len(playerName)))
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,451 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_server
import (
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_common"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_player"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_text"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_world"
witRuntime "go.bytecodealliance.org/pkg/wit/runtime"
witTypes "go.bytecodealliance.org/pkg/wit/types"
"runtime"
"unsafe"
)
type Player = pumpkin_plugin_player.Player
type GameMode = pumpkin_plugin_common.GameMode
type World = pumpkin_plugin_world.World
type TextComponent = pumpkin_plugin_text.TextComponent
const (
// Hostile mobs do not spawn. Players regain health automatically.
DifficultyPeaceful uint8 = 0
// Hostile mobs deal less damage.
DifficultyEasy uint8 = 1
// Standard Minecraft difficulty.
DifficultyNormal uint8 = 2
// Hostile mobs deal more damage.
DifficultyHard uint8 = 3
)
// Represents the difficulty setting of a Minecraft server.
type Difficulty = uint8
const (
DimensionOverworld uint8 = 0
DimensionNether uint8 = 1
DimensionEnd uint8 = 2
)
// Represents the three main Minecraft dimensions.
type Dimension = uint8
const (
CommandSenderConsole uint8 = 0
CommandSenderPlayer uint8 = 1
)
type CommandSender struct {
tag uint8
value any
}
func (self CommandSender) Tag() uint8 {
return self.tag
}
func (self CommandSender) Player() *pumpkin_plugin_player.Player {
if self.tag != CommandSenderPlayer {
panic("tag mismatch")
}
return self.value.(*pumpkin_plugin_player.Player)
}
func MakeCommandSenderConsole() CommandSender {
return CommandSender{CommandSenderConsole, nil}
}
func MakeCommandSenderPlayer(value *pumpkin_plugin_player.Player) CommandSender {
return CommandSender{CommandSenderPlayer, value}
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [resource-drop]server
func resourceDropServer(handle int32)
// Represents the global server instance.
type Server struct {
handle *witRuntime.Handle
}
func (self *Server) TakeHandle() int32 {
return self.handle.Take()
}
func (self *Server) SetHandle(handle int32) {
self.handle.Set(handle)
}
func (self *Server) Handle() int32 {
return self.handle.Use()
}
func (self *Server) Drop() {
handle := self.handle.TakeOrNil()
if handle != 0 {
resourceDropServer(handle)
}
}
func ServerFromOwnHandle(handleValue int32) *Server {
handle := witRuntime.MakeHandle(handleValue)
value := &Server{handle}
runtime.AddCleanup(value, func(_ int) {
handleValue := handle.TakeOrNil()
if handleValue != 0 {
resourceDropServer(handleValue)
}
}, 0)
return value
}
func ServerFromBorrowHandle(handleValue int32) *Server {
handle := witRuntime.MakeHandle(handleValue)
return &Server{handle}
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.get-difficulty
func wasm_import_method_server_get_difficulty(arg0 int32) int32
func (self *Server) GetDifficulty() Difficulty {
result := wasm_import_method_server_get_difficulty((self).Handle())
return uint8(result)
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.get-player-count
func wasm_import_method_server_get_player_count(arg0 int32) int32
func (self *Server) GetPlayerCount() uint32 {
result := wasm_import_method_server_get_player_count((self).Handle())
return uint32(result)
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.get-mspt
func wasm_import_method_server_get_mspt(arg0 int32) float64
func (self *Server) GetMspt() float64 {
result := wasm_import_method_server_get_mspt((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.get-tps
func wasm_import_method_server_get_tps(arg0 int32) float64
func (self *Server) GetTps() float64 {
result := wasm_import_method_server_get_tps((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.get-all-players
func wasm_import_method_server_get_all_players(arg0 int32, arg1 uintptr)
func (self *Server) GetAllPlayers() []*pumpkin_plugin_player.Player {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_server_get_all_players((self).Handle(), returnArea)
result := make([]*pumpkin_plugin_player.Player, 0, *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
for index := 0; index < int(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4))); index++ {
base := unsafe.Add(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0)))), index*4)
result = append(result, pumpkin_plugin_player.PlayerFromOwnHandle(int32(uintptr(*(*int32)(unsafe.Add(unsafe.Pointer(base), 0))))))
}
result0 := result
return result0
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.get-player-by-name
func wasm_import_method_server_get_player_by_name(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr)
func (self *Server) GetPlayerByName(name string) witTypes.Option[*pumpkin_plugin_player.Player] {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, 8, 4))
utf8 := unsafe.Pointer(unsafe.StringData(name))
pinner.Pin(utf8)
wasm_import_method_server_get_player_by_name((self).Handle(), uintptr(utf8), uint32(len(name)), returnArea)
var option witTypes.Option[*pumpkin_plugin_player.Player]
switch uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))) {
case 0:
option = witTypes.None[*pumpkin_plugin_player.Player]()
case 1:
option = witTypes.Some[*pumpkin_plugin_player.Player](pumpkin_plugin_player.PlayerFromOwnHandle(int32(uintptr(*(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 4))))))
default:
panic("unreachable")
}
result := option
return result
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.get-player-by-uuid
func wasm_import_method_server_get_player_by_uuid(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr)
func (self *Server) GetPlayerByUuid(id string) witTypes.Option[*pumpkin_plugin_player.Player] {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, 8, 4))
utf8 := unsafe.Pointer(unsafe.StringData(id))
pinner.Pin(utf8)
wasm_import_method_server_get_player_by_uuid((self).Handle(), uintptr(utf8), uint32(len(id)), returnArea)
var option witTypes.Option[*pumpkin_plugin_player.Player]
switch uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))) {
case 0:
option = witTypes.None[*pumpkin_plugin_player.Player]()
case 1:
option = witTypes.Some[*pumpkin_plugin_player.Player](pumpkin_plugin_player.PlayerFromOwnHandle(int32(uintptr(*(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 4))))))
default:
panic("unreachable")
}
result := option
return result
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.get-all-worlds
func wasm_import_method_server_get_all_worlds(arg0 int32, arg1 uintptr)
func (self *Server) GetAllWorlds() []*pumpkin_plugin_world.World {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_server_get_all_worlds((self).Handle(), returnArea)
result := make([]*pumpkin_plugin_world.World, 0, *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
for index := 0; index < int(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4))); index++ {
base := unsafe.Add(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0)))), index*4)
result = append(result, pumpkin_plugin_world.WorldFromOwnHandle(int32(uintptr(*(*int32)(unsafe.Add(unsafe.Pointer(base), 0))))))
}
result0 := result
return result0
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.get-world-by-name
func wasm_import_method_server_get_world_by_name(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr)
func (self *Server) GetWorldByName(name string) witTypes.Option[*pumpkin_plugin_world.World] {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, 8, 4))
utf8 := unsafe.Pointer(unsafe.StringData(name))
pinner.Pin(utf8)
wasm_import_method_server_get_world_by_name((self).Handle(), uintptr(utf8), uint32(len(name)), returnArea)
var option witTypes.Option[*pumpkin_plugin_world.World]
switch uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))) {
case 0:
option = witTypes.None[*pumpkin_plugin_world.World]()
case 1:
option = witTypes.Some[*pumpkin_plugin_world.World](pumpkin_plugin_world.WorldFromOwnHandle(int32(uintptr(*(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 4))))))
default:
panic("unreachable")
}
result := option
return result
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.execute-command
func wasm_import_method_server_execute_command(arg0 int32, arg1 uintptr, arg2 uint32, arg3 int32, arg4 int32)
func (self *Server) ExecuteCommand(command string, sender CommandSender) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(command))
pinner.Pin(utf8)
var variant int32
var variant0 int32
switch sender.Tag() {
case CommandSenderConsole:
variant = int32(0)
variant0 = 0
case CommandSenderPlayer:
payload := sender.Player()
variant = int32(1)
variant0 = (payload).TakeHandle()
default:
panic("unreachable")
}
wasm_import_method_server_execute_command((self).Handle(), uintptr(utf8), uint32(len(command)), variant, variant0)
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.create-world
func wasm_import_method_server_create_world(arg0 int32, arg1 uintptr, arg2 uint32, arg3 int32) int32
func (self *Server) CreateWorld(name string, dimension Dimension) *pumpkin_plugin_world.World {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(name))
pinner.Pin(utf8)
result := wasm_import_method_server_create_world((self).Handle(), uintptr(utf8), uint32(len(name)), int32(dimension))
return pumpkin_plugin_world.WorldFromOwnHandle(int32(uintptr(result)))
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.broadcast
func wasm_import_method_server_broadcast(arg0 int32, arg1 uintptr, arg2 uint32)
func (self *Server) Broadcast(message string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(message))
pinner.Pin(utf8)
wasm_import_method_server_broadcast((self).Handle(), uintptr(utf8), uint32(len(message)))
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.broadcast-tab-list-header-footer
func wasm_import_method_server_broadcast_tab_list_header_footer(arg0 int32, arg1 int32, arg2 int32)
func (self *Server) BroadcastTabListHeaderFooter(header *pumpkin_plugin_text.TextComponent, footer *pumpkin_plugin_text.TextComponent) {
wasm_import_method_server_broadcast_tab_list_header_footer((self).Handle(), (header).TakeHandle(), (footer).TakeHandle())
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.get-max-players
func wasm_import_method_server_get_max_players(arg0 int32) int32
func (self *Server) GetMaxPlayers() uint32 {
result := wasm_import_method_server_get_max_players((self).Handle())
return uint32(result)
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.is-hardcore
func wasm_import_method_server_is_hardcore(arg0 int32) int32
func (self *Server) IsHardcore() bool {
result := wasm_import_method_server_is_hardcore((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.is-online-mode
func wasm_import_method_server_is_online_mode(arg0 int32) int32
func (self *Server) IsOnlineMode() bool {
result := wasm_import_method_server_is_online_mode((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.get-motd
func wasm_import_method_server_get_motd(arg0 int32, arg1 uintptr)
func (self *Server) GetMotd() string {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_server_get_motd((self).Handle(), returnArea)
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
result := value
return result
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.has-whitelist
func wasm_import_method_server_has_whitelist(arg0 int32) int32
func (self *Server) HasWhitelist() bool {
result := wasm_import_method_server_has_whitelist((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.get-allow-nether
func wasm_import_method_server_get_allow_nether(arg0 int32) int32
func (self *Server) GetAllowNether() bool {
result := wasm_import_method_server_get_allow_nether((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.get-allow-end
func wasm_import_method_server_get_allow_end(arg0 int32) int32
func (self *Server) GetAllowEnd() bool {
result := wasm_import_method_server_get_allow_end((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.get-view-distance
func wasm_import_method_server_get_view_distance(arg0 int32) int32
func (self *Server) GetViewDistance() uint8 {
result := wasm_import_method_server_get_view_distance((self).Handle())
return uint8(result)
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.get-simulation-distance
func wasm_import_method_server_get_simulation_distance(arg0 int32) int32
func (self *Server) GetSimulationDistance() uint8 {
result := wasm_import_method_server_get_simulation_distance((self).Handle())
return uint8(result)
}
//go:wasmimport pumpkin:plugin/server@0.1.0 [method]server.get-default-gamemode
func wasm_import_method_server_get_default_gamemode(arg0 int32) int32
func (self *Server) GetDefaultGamemode() pumpkin_plugin_common.GameMode {
result := wasm_import_method_server_get_default_gamemode((self).Handle())
return uint8(result)
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,382 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_text
import (
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_common"
witRuntime "go.bytecodealliance.org/pkg/wit/runtime"
witTypes "go.bytecodealliance.org/pkg/wit/types"
"runtime"
"unsafe"
)
type NamedColor = pumpkin_plugin_common.NamedColor
type RgbColor = pumpkin_plugin_common.RgbColor
type ArgbColor = pumpkin_plugin_common.ArgbColor
//go:wasmimport pumpkin:plugin/text@0.1.0 [resource-drop]text-component
func resourceDropTextComponent(handle int32)
type TextComponent struct {
handle *witRuntime.Handle
}
func (self *TextComponent) TakeHandle() int32 {
return self.handle.Take()
}
func (self *TextComponent) SetHandle(handle int32) {
self.handle.Set(handle)
}
func (self *TextComponent) Handle() int32 {
return self.handle.Use()
}
func (self *TextComponent) Drop() {
handle := self.handle.TakeOrNil()
if handle != 0 {
resourceDropTextComponent(handle)
}
}
func TextComponentFromOwnHandle(handleValue int32) *TextComponent {
handle := witRuntime.MakeHandle(handleValue)
value := &TextComponent{handle}
runtime.AddCleanup(value, func(_ int) {
handleValue := handle.TakeOrNil()
if handleValue != 0 {
resourceDropTextComponent(handleValue)
}
}, 0)
return value
}
func TextComponentFromBorrowHandle(handleValue int32) *TextComponent {
handle := witRuntime.MakeHandle(handleValue)
return &TextComponent{handle}
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [static]text-component.text
func wasm_import_static_text_component_text(arg0 uintptr, arg1 uint32) int32
func TextComponentText(plain string) *TextComponent {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(plain))
pinner.Pin(utf8)
result := wasm_import_static_text_component_text(uintptr(utf8), uint32(len(plain)))
return TextComponentFromOwnHandle(int32(uintptr(result)))
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [static]text-component.translate
func wasm_import_static_text_component_translate(arg0 uintptr, arg1 uint32, arg2 uintptr, arg3 uint32) int32
func TextComponentTranslate(key string, with []*TextComponent) *TextComponent {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(key))
pinner.Pin(utf8)
slice := with
length := uint32(len(slice))
result := witRuntime.Allocate(pinner, uintptr(length*4), 4)
for index, element := range slice {
base := unsafe.Add(result, index*4)
*(*int32)(unsafe.Add(unsafe.Pointer(base), 0)) = (element).TakeHandle()
}
result0 := wasm_import_static_text_component_translate(uintptr(utf8), uint32(len(key)), uintptr(result), length)
return TextComponentFromOwnHandle(int32(uintptr(result0)))
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.add-child
func wasm_import_method_text_component_add_child(arg0 int32, arg1 int32)
func (self *TextComponent) AddChild(child *TextComponent) {
wasm_import_method_text_component_add_child((self).Handle(), (child).TakeHandle())
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.add-text
func wasm_import_method_text_component_add_text(arg0 int32, arg1 uintptr, arg2 uint32)
func (self *TextComponent) AddText(text string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(text))
pinner.Pin(utf8)
wasm_import_method_text_component_add_text((self).Handle(), uintptr(utf8), uint32(len(text)))
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.get-text
func wasm_import_method_text_component_get_text(arg0 int32, arg1 uintptr)
func (self *TextComponent) GetText() string {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_text_component_get_text((self).Handle(), returnArea)
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
result := value
return result
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.encode
func wasm_import_method_text_component_encode(arg0 int32, arg1 uintptr)
func (self *TextComponent) Encode() []uint8 {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_text_component_encode((self).Handle(), returnArea)
value := unsafe.Slice((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
result := value
return result
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.color-named
func wasm_import_method_text_component_color_named(arg0 int32, arg1 int32)
func (self *TextComponent) ColorNamed(color pumpkin_plugin_common.NamedColor) {
wasm_import_method_text_component_color_named((self).Handle(), int32(color))
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.color-rgb
func wasm_import_method_text_component_color_rgb(arg0 int32, arg1 int32, arg2 int32, arg3 int32)
func (self *TextComponent) ColorRgb(color pumpkin_plugin_common.RgbColor) {
wasm_import_method_text_component_color_rgb((self).Handle(), int32((color).R), int32((color).G), int32((color).B))
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.bold
func wasm_import_method_text_component_bold(arg0 int32, arg1 int32)
func (self *TextComponent) Bold(value bool) {
var result int32
if value {
result = 1
} else {
result = 0
}
wasm_import_method_text_component_bold((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.italic
func wasm_import_method_text_component_italic(arg0 int32, arg1 int32)
func (self *TextComponent) Italic(value bool) {
var result int32
if value {
result = 1
} else {
result = 0
}
wasm_import_method_text_component_italic((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.underlined
func wasm_import_method_text_component_underlined(arg0 int32, arg1 int32)
func (self *TextComponent) Underlined(value bool) {
var result int32
if value {
result = 1
} else {
result = 0
}
wasm_import_method_text_component_underlined((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.strikethrough
func wasm_import_method_text_component_strikethrough(arg0 int32, arg1 int32)
func (self *TextComponent) Strikethrough(value bool) {
var result int32
if value {
result = 1
} else {
result = 0
}
wasm_import_method_text_component_strikethrough((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.obfuscated
func wasm_import_method_text_component_obfuscated(arg0 int32, arg1 int32)
func (self *TextComponent) Obfuscated(value bool) {
var result int32
if value {
result = 1
} else {
result = 0
}
wasm_import_method_text_component_obfuscated((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.insertion
func wasm_import_method_text_component_insertion(arg0 int32, arg1 uintptr, arg2 uint32)
func (self *TextComponent) Insertion(text string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(text))
pinner.Pin(utf8)
wasm_import_method_text_component_insertion((self).Handle(), uintptr(utf8), uint32(len(text)))
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.font
func wasm_import_method_text_component_font(arg0 int32, arg1 uintptr, arg2 uint32)
func (self *TextComponent) Font(font string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(font))
pinner.Pin(utf8)
wasm_import_method_text_component_font((self).Handle(), uintptr(utf8), uint32(len(font)))
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.shadow-color
func wasm_import_method_text_component_shadow_color(arg0 int32, arg1 int32, arg2 int32, arg3 int32, arg4 int32)
func (self *TextComponent) ShadowColor(color pumpkin_plugin_common.ArgbColor) {
wasm_import_method_text_component_shadow_color((self).Handle(), int32((color).A), int32((color).R), int32((color).G), int32((color).B))
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.click-open-url
func wasm_import_method_text_component_click_open_url(arg0 int32, arg1 uintptr, arg2 uint32)
func (self *TextComponent) ClickOpenUrl(url string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(url))
pinner.Pin(utf8)
wasm_import_method_text_component_click_open_url((self).Handle(), uintptr(utf8), uint32(len(url)))
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.click-run-command
func wasm_import_method_text_component_click_run_command(arg0 int32, arg1 uintptr, arg2 uint32)
func (self *TextComponent) ClickRunCommand(command string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(command))
pinner.Pin(utf8)
wasm_import_method_text_component_click_run_command((self).Handle(), uintptr(utf8), uint32(len(command)))
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.click-suggest-command
func wasm_import_method_text_component_click_suggest_command(arg0 int32, arg1 uintptr, arg2 uint32)
func (self *TextComponent) ClickSuggestCommand(command string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(command))
pinner.Pin(utf8)
wasm_import_method_text_component_click_suggest_command((self).Handle(), uintptr(utf8), uint32(len(command)))
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.click-copy-to-clipboard
func wasm_import_method_text_component_click_copy_to_clipboard(arg0 int32, arg1 uintptr, arg2 uint32)
func (self *TextComponent) ClickCopyToClipboard(text string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(text))
pinner.Pin(utf8)
wasm_import_method_text_component_click_copy_to_clipboard((self).Handle(), uintptr(utf8), uint32(len(text)))
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.hover-show-text
func wasm_import_method_text_component_hover_show_text(arg0 int32, arg1 int32)
func (self *TextComponent) HoverShowText(text *TextComponent) {
wasm_import_method_text_component_hover_show_text((self).Handle(), (text).TakeHandle())
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.hover-show-item
func wasm_import_method_text_component_hover_show_item(arg0 int32, arg1 uintptr, arg2 uint32)
func (self *TextComponent) HoverShowItem(item string) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(item))
pinner.Pin(utf8)
wasm_import_method_text_component_hover_show_item((self).Handle(), uintptr(utf8), uint32(len(item)))
}
//go:wasmimport pumpkin:plugin/text@0.1.0 [method]text-component.hover-show-entity
func wasm_import_method_text_component_hover_show_entity(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr, arg4 uint32, arg5 int32, arg6 int32)
func (self *TextComponent) HoverShowEntity(entityType string, id string, name witTypes.Option[*TextComponent]) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(entityType))
pinner.Pin(utf8)
utf80 := unsafe.Pointer(unsafe.StringData(id))
pinner.Pin(utf80)
var option int32
var option1 int32
switch name.Tag() {
case witTypes.OptionNone:
option = int32(0)
option1 = 0
case witTypes.OptionSome:
payload := name.Some()
option = int32(1)
option1 = (payload).TakeHandle()
default:
panic("unreachable")
}
wasm_import_method_text_component_hover_show_entity((self).Handle(), uintptr(utf8), uint32(len(entityType)), uintptr(utf80), uint32(len(id)), option, option1)
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,977 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package pumpkin_plugin_world
import (
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_common"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_scoreboard"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_text"
witRuntime "go.bytecodealliance.org/pkg/wit/runtime"
witTypes "go.bytecodealliance.org/pkg/wit/types"
"runtime"
"unsafe"
)
type Position = witTypes.Tuple3[float64, float64, float64]
type EntityPose = pumpkin_plugin_common.EntityPose
type TextComponent = pumpkin_plugin_text.TextComponent
type Scoreboard = pumpkin_plugin_scoreboard.Scoreboard
const (
// Normal behavior; the block can be pushed and pulled.
PistonBehaviorNormal uint8 = 0
// The block is destroyed when pushed.
PistonBehaviorDestroy uint8 = 1
// The block cannot be pushed or pulled.
PistonBehaviorBlock uint8 = 2
// The block is ignored by pistons.
PistonBehaviorIgnore uint8 = 3
// The block can only be pushed, not pulled.
PistonBehaviorPushOnly uint8 = 4
)
// Defines how a block reacts when pushed by a piston.
type PistonBehavior = uint8
const (
SoundCategoryMaster uint8 = 0
SoundCategoryMusic uint8 = 1
SoundCategoryRecords uint8 = 2
SoundCategoryWeather uint8 = 3
SoundCategoryBlocks uint8 = 4
SoundCategoryHostile uint8 = 5
SoundCategoryNeutral uint8 = 6
SoundCategoryPlayers uint8 = 7
SoundCategoryAmbient uint8 = 8
SoundCategoryVoice uint8 = 9
)
// Categories for sounds to control their volume independently.
type SoundCategory = uint8
const (
// No interaction with blocks.
ExplosionInteractionNone uint8 = 0
// Blocks are destroyed and may drop loot.
ExplosionInteractionBlock uint8 = 1
// Interaction typical for mob-caused explosions.
ExplosionInteractionMob uint8 = 2
// Interaction typical for TNT explosions.
ExplosionInteractionTnt uint8 = 3
// Triggers specific block behaviors.
ExplosionInteractionTrigger uint8 = 4
)
// Defines how an explosion interacts with blocks in the world.
type ExplosionInteraction = uint8
const (
// Notifies neighbor blocks of the change.
BlockFlagsNotifyNeighbors uint8 = 1 << 0
// Notifies client listeners of the change.
BlockFlagsNotifyListeners uint8 = 1 << 1
// Forces the block state even if it's the same.
BlockFlagsForceState uint8 = 1 << 2
// Skips dropping items when the block is removed.
BlockFlagsSkipDrops uint8 = 1 << 3
// Indicates the block was moved (e.g., by a piston).
BlockFlagsMoved uint8 = 1 << 4
// Skips state replacement for redstone wires.
BlockFlagsSkipRedstoneWireStateReplacement uint8 = 1 << 5
// Skips the callback when a block entity is replaced.
BlockFlagsSkipBlockEntityReplacedCallback uint8 = 1 << 6
// Skips the callback when a block is added.
BlockFlagsSkipBlockAddedCallback uint8 = 1 << 7
)
// Flags used to control block updates and notifications.
type BlockFlags = uint8
// Detailed information about a block's state.
type BlockState struct {
// The internal numerical ID of the block state.
Id uint16
// The light level emitted by this block (0-15).
Luminance uint8
// How much light this block blocks.
Opacity uint8
// The hardness of the block, determining mining speed.
Hardness float32
// Whether this block is considered air.
IsAir bool
// Whether this block is a liquid.
IsLiquid bool
// Whether this block is a solid.
IsSolid bool
// Whether this block occupies a full cube.
IsFullCube bool
// How this block behaves when pushed by a piston.
PistonBehavior PistonBehavior
// Whether this block receives random ticks.
HasRandomTicks bool
}
// A simple wrapper for a block state ID.
type BlockStateId struct {
Id uint16
}
// A position in the world grid.
type BlockPos struct {
X int32
Y int32
Z int32
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [resource-drop]entity
func resourceDropEntity(handle int32)
type Entity struct {
handle *witRuntime.Handle
}
func (self *Entity) TakeHandle() int32 {
return self.handle.Take()
}
func (self *Entity) SetHandle(handle int32) {
self.handle.Set(handle)
}
func (self *Entity) Handle() int32 {
return self.handle.Use()
}
func (self *Entity) Drop() {
handle := self.handle.TakeOrNil()
if handle != 0 {
resourceDropEntity(handle)
}
}
func EntityFromOwnHandle(handleValue int32) *Entity {
handle := witRuntime.MakeHandle(handleValue)
value := &Entity{handle}
runtime.AddCleanup(value, func(_ int) {
handleValue := handle.TakeOrNil()
if handleValue != 0 {
resourceDropEntity(handleValue)
}
}, 0)
return value
}
func EntityFromBorrowHandle(handleValue int32) *Entity {
handle := witRuntime.MakeHandle(handleValue)
return &Entity{handle}
}
const (
BlockDirectionDown uint8 = 0
BlockDirectionUp uint8 = 1
BlockDirectionNorth uint8 = 2
BlockDirectionSouth uint8 = 3
BlockDirectionWest uint8 = 4
BlockDirectionEast uint8 = 5
)
// Represents a cardinal direction or block face.
type BlockDirection = uint8
// Result of a raycast operation.
type RaycastResult struct {
// The block position that was hit.
Pos BlockPos
// The face of the block that was hit.
Face BlockDirection
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [resource-drop]world
func resourceDropWorld(handle int32)
// Represents a Minecraft world (dimension).
type World struct {
handle *witRuntime.Handle
}
func (self *World) TakeHandle() int32 {
return self.handle.Take()
}
func (self *World) SetHandle(handle int32) {
self.handle.Set(handle)
}
func (self *World) Handle() int32 {
return self.handle.Use()
}
func (self *World) Drop() {
handle := self.handle.TakeOrNil()
if handle != 0 {
resourceDropWorld(handle)
}
}
func WorldFromOwnHandle(handleValue int32) *World {
handle := witRuntime.MakeHandle(handleValue)
value := &World{handle}
runtime.AddCleanup(value, func(_ int) {
handleValue := handle.TakeOrNil()
if handleValue != 0 {
resourceDropWorld(handleValue)
}
}, 0)
return value
}
func WorldFromBorrowHandle(handleValue int32) *World {
handle := witRuntime.MakeHandle(handleValue)
return &World{handle}
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-id
func wasm_import_method_entity_get_id(arg0 int32) int32
func (self *Entity) GetId() uint32 {
result := wasm_import_method_entity_get_id((self).Handle())
return uint32(result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-uuid
func wasm_import_method_entity_get_uuid(arg0 int32, arg1 uintptr)
func (self *Entity) GetUuid() string {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_entity_get_uuid((self).Handle(), returnArea)
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
result := value
return result
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-type
func wasm_import_method_entity_get_type(arg0 int32, arg1 uintptr)
func (self *Entity) GetType() string {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_entity_get_type((self).Handle(), returnArea)
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
result := value
return result
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-position
func wasm_import_method_entity_get_position(arg0 int32, arg1 uintptr)
func (self *Entity) GetPosition() witTypes.Tuple3[float64, float64, float64] {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, 24, 8))
wasm_import_method_entity_get_position((self).Handle(), returnArea)
result := witTypes.Tuple3[float64, float64, float64]{*(*float64)(unsafe.Add(unsafe.Pointer(returnArea), 0)), *(*float64)(unsafe.Add(unsafe.Pointer(returnArea), 8)), *(*float64)(unsafe.Add(unsafe.Pointer(returnArea), 16))}
return result
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-world
func wasm_import_method_entity_get_world(arg0 int32) int32
func (self *Entity) GetWorld() *World {
result := wasm_import_method_entity_get_world((self).Handle())
return WorldFromOwnHandle(int32(uintptr(result)))
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-yaw
func wasm_import_method_entity_get_yaw(arg0 int32) float32
func (self *Entity) GetYaw() float32 {
result := wasm_import_method_entity_get_yaw((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-pitch
func wasm_import_method_entity_get_pitch(arg0 int32) float32
func (self *Entity) GetPitch() float32 {
result := wasm_import_method_entity_get_pitch((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-head-yaw
func wasm_import_method_entity_get_head_yaw(arg0 int32) float32
func (self *Entity) GetHeadYaw() float32 {
result := wasm_import_method_entity_get_head_yaw((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-on-ground
func wasm_import_method_entity_is_on_ground(arg0 int32) int32
func (self *Entity) IsOnGround() bool {
result := wasm_import_method_entity_is_on_ground((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-sneaking
func wasm_import_method_entity_is_sneaking(arg0 int32) int32
func (self *Entity) IsSneaking() bool {
result := wasm_import_method_entity_is_sneaking((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-sneaking
func wasm_import_method_entity_set_sneaking(arg0 int32, arg1 int32)
func (self *Entity) SetSneaking(sneaking bool) {
var result int32
if sneaking {
result = 1
} else {
result = 0
}
wasm_import_method_entity_set_sneaking((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-sprinting
func wasm_import_method_entity_is_sprinting(arg0 int32) int32
func (self *Entity) IsSprinting() bool {
result := wasm_import_method_entity_is_sprinting((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-sprinting
func wasm_import_method_entity_set_sprinting(arg0 int32, arg1 int32)
func (self *Entity) SetSprinting(sprinting bool) {
var result int32
if sprinting {
result = 1
} else {
result = 0
}
wasm_import_method_entity_set_sprinting((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-swimming
func wasm_import_method_entity_is_swimming(arg0 int32) int32
func (self *Entity) IsSwimming() bool {
result := wasm_import_method_entity_is_swimming((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-swimming
func wasm_import_method_entity_set_swimming(arg0 int32, arg1 int32)
func (self *Entity) SetSwimming(swimming bool) {
var result int32
if swimming {
result = 1
} else {
result = 0
}
wasm_import_method_entity_set_swimming((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-invisible
func wasm_import_method_entity_is_invisible(arg0 int32) int32
func (self *Entity) IsInvisible() bool {
result := wasm_import_method_entity_is_invisible((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-invisible
func wasm_import_method_entity_set_invisible(arg0 int32, arg1 int32)
func (self *Entity) SetInvisible(invisible bool) {
var result int32
if invisible {
result = 1
} else {
result = 0
}
wasm_import_method_entity_set_invisible((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-glowing
func wasm_import_method_entity_is_glowing(arg0 int32) int32
func (self *Entity) IsGlowing() bool {
result := wasm_import_method_entity_is_glowing((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-glowing
func wasm_import_method_entity_set_glowing(arg0 int32, arg1 int32)
func (self *Entity) SetGlowing(glowing bool) {
var result int32
if glowing {
result = 1
} else {
result = 0
}
wasm_import_method_entity_set_glowing((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-fall-flying
func wasm_import_method_entity_is_fall_flying(arg0 int32) int32
func (self *Entity) IsFallFlying() bool {
result := wasm_import_method_entity_is_fall_flying((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-fall-flying
func wasm_import_method_entity_set_fall_flying(arg0 int32, arg1 int32)
func (self *Entity) SetFallFlying(fallFlying bool) {
var result int32
if fallFlying {
result = 1
} else {
result = 0
}
wasm_import_method_entity_set_fall_flying((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-on-fire
func wasm_import_method_entity_is_on_fire(arg0 int32) int32
func (self *Entity) IsOnFire() bool {
result := wasm_import_method_entity_is_on_fire((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-on-fire
func wasm_import_method_entity_set_on_fire(arg0 int32, arg1 int32)
func (self *Entity) SetOnFire(onFire bool) {
var result int32
if onFire {
result = 1
} else {
result = 0
}
wasm_import_method_entity_set_on_fire((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.teleport
func wasm_import_method_entity_teleport(arg0 int32, arg1 float64, arg2 float64, arg3 float64, arg4 int32)
func (self *Entity) Teleport(pos witTypes.Tuple3[float64, float64, float64], worldRef *World) {
wasm_import_method_entity_teleport((self).Handle(), (pos).F0, (pos).F1, (pos).F2, (worldRef).TakeHandle())
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-velocity
func wasm_import_method_entity_set_velocity(arg0 int32, arg1 float64, arg2 float64, arg3 float64)
func (self *Entity) SetVelocity(velocity witTypes.Tuple3[float64, float64, float64]) {
wasm_import_method_entity_set_velocity((self).Handle(), (velocity).F0, (velocity).F1, (velocity).F2)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-velocity
func wasm_import_method_entity_get_velocity(arg0 int32, arg1 uintptr)
func (self *Entity) GetVelocity() witTypes.Tuple3[float64, float64, float64] {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, 24, 8))
wasm_import_method_entity_get_velocity((self).Handle(), returnArea)
result := witTypes.Tuple3[float64, float64, float64]{*(*float64)(unsafe.Add(unsafe.Pointer(returnArea), 0)), *(*float64)(unsafe.Add(unsafe.Pointer(returnArea), 8)), *(*float64)(unsafe.Add(unsafe.Pointer(returnArea), 16))}
return result
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-pose
func wasm_import_method_entity_get_pose(arg0 int32) int32
func (self *Entity) GetPose() pumpkin_plugin_common.EntityPose {
result := wasm_import_method_entity_get_pose((self).Handle())
return uint8(result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-name
func wasm_import_method_entity_get_name(arg0 int32) int32
func (self *Entity) GetName() *pumpkin_plugin_text.TextComponent {
result := wasm_import_method_entity_get_name((self).Handle())
return pumpkin_plugin_text.TextComponentFromOwnHandle(int32(uintptr(result)))
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-custom-name
func wasm_import_method_entity_set_custom_name(arg0 int32, arg1 int32)
func (self *Entity) SetCustomName(name *pumpkin_plugin_text.TextComponent) {
wasm_import_method_entity_set_custom_name((self).Handle(), (name).TakeHandle())
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-custom-name
func wasm_import_method_entity_get_custom_name(arg0 int32, arg1 uintptr)
func (self *Entity) GetCustomName() witTypes.Option[*pumpkin_plugin_text.TextComponent] {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, 8, 4))
wasm_import_method_entity_get_custom_name((self).Handle(), returnArea)
var option witTypes.Option[*pumpkin_plugin_text.TextComponent]
switch uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))) {
case 0:
option = witTypes.None[*pumpkin_plugin_text.TextComponent]()
case 1:
option = witTypes.Some[*pumpkin_plugin_text.TextComponent](pumpkin_plugin_text.TextComponentFromOwnHandle(int32(uintptr(*(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 4))))))
default:
panic("unreachable")
}
result := option
return result
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-custom-name-visible
func wasm_import_method_entity_set_custom_name_visible(arg0 int32, arg1 int32)
func (self *Entity) SetCustomNameVisible(visible bool) {
var result int32
if visible {
result = 1
} else {
result = 0
}
wasm_import_method_entity_set_custom_name_visible((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-custom-name-visible
func wasm_import_method_entity_is_custom_name_visible(arg0 int32) int32
func (self *Entity) IsCustomNameVisible() bool {
result := wasm_import_method_entity_is_custom_name_visible((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-invulnerable
func wasm_import_method_entity_is_invulnerable(arg0 int32) int32
func (self *Entity) IsInvulnerable() bool {
result := wasm_import_method_entity_is_invulnerable((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-invulnerable
func wasm_import_method_entity_set_invulnerable(arg0 int32, arg1 int32)
func (self *Entity) SetInvulnerable(invulnerable bool) {
var result int32
if invulnerable {
result = 1
} else {
result = 0
}
wasm_import_method_entity_set_invulnerable((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-fire-ticks
func wasm_import_method_entity_get_fire_ticks(arg0 int32) int32
func (self *Entity) GetFireTicks() int32 {
result := wasm_import_method_entity_get_fire_ticks((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-fire-ticks
func wasm_import_method_entity_set_fire_ticks(arg0 int32, arg1 int32)
func (self *Entity) SetFireTicks(ticks int32) {
wasm_import_method_entity_set_fire_ticks((self).Handle(), ticks)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.remove
func wasm_import_method_entity_remove(arg0 int32)
func (self *Entity) Remove() {
wasm_import_method_entity_remove((self).Handle())
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.raycast
func wasm_import_method_entity_raycast(arg0 int32, arg1 float64, arg2 int32, arg3 uintptr)
func (self *Entity) Raycast(maxDistance float64, fluidHandling bool) witTypes.Option[RaycastResult] {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, 20, 4))
var result int32
if fluidHandling {
result = 1
} else {
result = 0
}
wasm_import_method_entity_raycast((self).Handle(), maxDistance, result, returnArea)
var option witTypes.Option[RaycastResult]
switch uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))) {
case 0:
option = witTypes.None[RaycastResult]()
case 1:
option = witTypes.Some[RaycastResult](RaycastResult{BlockPos{*(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 4)), *(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 8)), *(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 12))}, uint8(uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 16))))})
default:
panic("unreachable")
}
result0 := option
return result0
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-id
func wasm_import_method_world_get_id(arg0 int32, arg1 uintptr)
func (self *World) GetId() string {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_world_get_id((self).Handle(), returnArea)
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
result := value
return result
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-block-state-id
func wasm_import_method_world_get_block_state_id(arg0 int32, arg1 int32, arg2 int32, arg3 int32) int32
func (self *World) GetBlockStateId(pos BlockPos) uint16 {
result := wasm_import_method_world_get_block_state_id((self).Handle(), (pos).X, (pos).Y, (pos).Z)
return uint16(result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-block-state
func wasm_import_method_world_get_block_state(arg0 int32, arg1 int32, arg2 int32, arg3 int32, arg4 uintptr)
func (self *World) GetBlockState(pos BlockPos) BlockState {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, 16, 4))
wasm_import_method_world_get_block_state((self).Handle(), (pos).X, (pos).Y, (pos).Z, returnArea)
result := BlockState{uint16(uint16(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0)))), uint8(uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 2)))), uint8(uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 3)))), *(*float32)(unsafe.Add(unsafe.Pointer(returnArea), 4)), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 8))) != 0), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 9))) != 0), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 10))) != 0), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 11))) != 0), uint8(uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 12)))), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 13))) != 0)}
return result
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.set-block-state
func wasm_import_method_world_set_block_state(arg0 int32, arg1 int32, arg2 int32, arg3 int32, arg4 int32, arg5 int32)
func (self *World) SetBlockState(pos BlockPos, state uint16, updateFlags BlockFlags) {
wasm_import_method_world_set_block_state((self).Handle(), (pos).X, (pos).Y, (pos).Z, int32(state), int32(updateFlags))
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-time-of-day
func wasm_import_method_world_get_time_of_day(arg0 int32) int64
func (self *World) GetTimeOfDay() uint64 {
result := wasm_import_method_world_get_time_of_day((self).Handle())
return uint64(result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.set-time-of-day
func wasm_import_method_world_set_time_of_day(arg0 int32, arg1 int64)
func (self *World) SetTimeOfDay(time uint64) {
wasm_import_method_world_set_time_of_day((self).Handle(), int64(time))
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-world-age
func wasm_import_method_world_get_world_age(arg0 int32) int64
func (self *World) GetWorldAge() uint64 {
result := wasm_import_method_world_get_world_age((self).Handle())
return uint64(result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-dimension
func wasm_import_method_world_get_dimension(arg0 int32, arg1 uintptr)
func (self *World) GetDimension() string {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_world_get_dimension((self).Handle(), returnArea)
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
result := value
return result
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-top-block-y
func wasm_import_method_world_get_top_block_y(arg0 int32, arg1 int32, arg2 int32) int32
func (self *World) GetTopBlockY(x int32, z int32) int32 {
result := wasm_import_method_world_get_top_block_y((self).Handle(), x, z)
return result
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-motion-blocking-height
func wasm_import_method_world_get_motion_blocking_height(arg0 int32, arg1 int32, arg2 int32) int32
func (self *World) GetMotionBlockingHeight(x int32, z int32) int32 {
result := wasm_import_method_world_get_motion_blocking_height((self).Handle(), x, z)
return result
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.is-raining
func wasm_import_method_world_is_raining(arg0 int32) int32
func (self *World) IsRaining() bool {
result := wasm_import_method_world_is_raining((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.set-raining
func wasm_import_method_world_set_raining(arg0 int32, arg1 int32)
func (self *World) SetRaining(raining bool) {
var result int32
if raining {
result = 1
} else {
result = 0
}
wasm_import_method_world_set_raining((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.is-thundering
func wasm_import_method_world_is_thundering(arg0 int32) int32
func (self *World) IsThundering() bool {
result := wasm_import_method_world_is_thundering((self).Handle())
return (result != 0)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.set-thundering
func wasm_import_method_world_set_thundering(arg0 int32, arg1 int32)
func (self *World) SetThundering(thundering bool) {
var result int32
if thundering {
result = 1
} else {
result = 0
}
wasm_import_method_world_set_thundering((self).Handle(), result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.broadcast-system-message
func wasm_import_method_world_broadcast_system_message(arg0 int32, arg1 int32, arg2 int32)
func (self *World) BroadcastSystemMessage(message *pumpkin_plugin_text.TextComponent, overlay bool) {
var result int32
if overlay {
result = 1
} else {
result = 0
}
wasm_import_method_world_broadcast_system_message((self).Handle(), (message).TakeHandle(), result)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-scoreboard
func wasm_import_method_world_get_scoreboard(arg0 int32) int32
func (self *World) GetScoreboard() *pumpkin_plugin_scoreboard.Scoreboard {
result := wasm_import_method_world_get_scoreboard((self).Handle())
return pumpkin_plugin_scoreboard.ScoreboardFromOwnHandle(int32(uintptr(result)))
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.play-sound
func wasm_import_method_world_play_sound(arg0 int32, arg1 uintptr, arg2 uint32, arg3 int32, arg4 float64, arg5 float64, arg6 float64, arg7 float32, arg8 float32)
func (self *World) PlaySound(sound string, category SoundCategory, pos witTypes.Tuple3[float64, float64, float64], volume float32, pitch float32) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(sound))
pinner.Pin(utf8)
wasm_import_method_world_play_sound((self).Handle(), uintptr(utf8), uint32(len(sound)), int32(category), (pos).F0, (pos).F1, (pos).F2, volume, pitch)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.spawn-particle
func wasm_import_method_world_spawn_particle(arg0 int32, arg1 uintptr, arg2 uint32, arg3 float64, arg4 float64, arg5 float64, arg6 float64, arg7 float64, arg8 float64, arg9 float32, arg10 int32)
func (self *World) SpawnParticle(particle string, pos witTypes.Tuple3[float64, float64, float64], offset witTypes.Tuple3[float64, float64, float64], maxSpeed float32, count int32) {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
utf8 := unsafe.Pointer(unsafe.StringData(particle))
pinner.Pin(utf8)
wasm_import_method_world_spawn_particle((self).Handle(), uintptr(utf8), uint32(len(particle)), (pos).F0, (pos).F1, (pos).F2, (offset).F0, (offset).F1, (offset).F2, maxSpeed, count)
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.create-explosion
func wasm_import_method_world_create_explosion(arg0 int32, arg1 float64, arg2 float64, arg3 float64, arg4 float32, arg5 int32, arg6 int32)
func (self *World) CreateExplosion(pos witTypes.Tuple3[float64, float64, float64], power float32, createFire bool, interaction ExplosionInteraction) {
var result int32
if createFire {
result = 1
} else {
result = 0
}
wasm_import_method_world_create_explosion((self).Handle(), (pos).F0, (pos).F1, (pos).F2, power, result, int32(interaction))
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-sea-level
func wasm_import_method_world_get_sea_level(arg0 int32) int32
func (self *World) GetSeaLevel() int32 {
result := wasm_import_method_world_get_sea_level((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-min-y
func wasm_import_method_world_get_min_y(arg0 int32) int32
func (self *World) GetMinY() int32 {
result := wasm_import_method_world_get_min_y((self).Handle())
return result
}
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-entities
func wasm_import_method_world_get_entities(arg0 int32, arg1 uintptr)
func (self *World) GetEntities() []*Entity {
pinner := &runtime.Pinner{}
defer pinner.Unpin()
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
wasm_import_method_world_get_entities((self).Handle(), returnArea)
result := make([]*Entity, 0, *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
for index := 0; index < int(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4))); index++ {
base := unsafe.Add(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0)))), index*4)
result = append(result, EntityFromOwnHandle(int32(uintptr(*(*int32)(unsafe.Add(unsafe.Pointer(base), 0))))))
}
result0 := result
return result0
}

File diff suppressed because it is too large Load Diff

3
pkg/wit_world/empty.s Normal file
View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,20 @@
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
// This code was generated from the following packages:
// pumpkin:plugin@0.1.0
package wit_world
import (
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_command"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_context"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_event"
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_server"
)
type Context = pumpkin_plugin_context.Context
type Event = pumpkin_plugin_event.Event
type ServerInstance = pumpkin_plugin_server.Server
type CommandSender = pumpkin_plugin_command.CommandSender
type ConsumedArgs = pumpkin_plugin_command.ConsumedArgs
type CommandError = pumpkin_plugin_command.CommandError