Update .gitignore, CODE_OF_CONDUCT.md, CONTRIBUTING.md, and 1010 more files

This commit is contained in:
Michael Sebero 2023-08-13 21:22:15 -04:00
parent 890466c012
commit e997a6a48e
1012 changed files with 17125 additions and 32181 deletions

3
.gitignore vendored
View File

@ -4,5 +4,4 @@
*.blend2
*.blend3
/.idea/
*.xcf
.Rproj.user
*.xcf

View File

@ -1,128 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
ancientmariner_dev@proton.me.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

View File

@ -1,420 +0,0 @@
# Contributing to MineClone2
So you want to contribute to MineClone2?
Wow, thank you! :-)
MineClone2 is maintained by AncientMariner and Nicu. If you have any
problems or questions, contact us on Discord/Matrix (See Links section below).
You can help with MineClone2's development in many different ways,
whether you're a programmer or not.
## MineClone2's development target is to...
- Create a stable, peformant, moddable, free/libre game based on Minecraft
using the Minetest engine, usable in both singleplayer and multiplayer.
- Currently, a lot of features are already implemented.
Polishing existing features is always welcome.
## Links
* [Mesehub](https://git.minetest.land/MineClone2/MineClone2)
* [Discord](https://discord.gg/xE4z8EEpDC)
* [YouTube](https://www.youtube.com/channel/UClI_YcsXMF3KNeJtoBfnk9A)
* [IRC](https://web.libera.chat/#mineclone2)
* [Matrix](https://app.element.io/#/room/#mc2:matrix.org)
* [Reddit](https://www.reddit.com/r/MineClone2/)
* [Minetest forums](https://forum.minetest.net/viewtopic.php?f=50&t=16407)
* [ContentDB](https://content.minetest.net/packages/wuzzy/mineclone2/)
* [OpenCollective](https://opencollective.com/mineclone2)
## Using git
MineClone2 is developed using the version control system
[git](https://git-scm.com/). If you want to contribute code to the
project, it is **highly recommended** that you learn the git basics.
For non-programmers and people who do not plan to contribute code to
MineClone2, git is not required. However, git is a tool that will be
referenced frequently because of its usefulness. As such, it is valuable
in learning how git works and its terminology. It can also help you
keeping your game updated, and easily test pull requests.
Look at our wiki for some concrete guides:
https://git.minetest.land/MineClone2/MineClone2/wiki/
## How you can help as a non-programmer
As someone who does not know how to write programs in Lua or does not
know how to use the Minetest API, you can still help us out a lot. For
example, by opening an issue in the
[Issue tracker](https://git.minetest.land/MineClone2/MineClone2/issues),
you can report a bug or request a feature.
### Rules about both bugs and feature requests
* Stay polite towards the developers and anyone else involved in the
discussion.
* Choose a descriptive title (e.g. not just "crash", "bug" or "question"
).
* Always check the currently opened issues before creating a new one.
Try not to report bugs that have already been reported or request features
that already have been requested. This can often be ambiguous though.
If in doubt open an issue!
* If you know about Minetest's inner workings, please think about
whether the bug / the feature that you are reporting / requesting is
actually an issue with Minetest itself, and if it is, head to the
[Minetest issue tracker](https://github.com/minetest/minetest/issues)
instead.
* If you need any help regarding creating a Mesehub account or opening
an issue, feel free to ask on the Discord / Matrix server or the IRC
channel.
The link to the mesehub registration page is: https://git.minetest.land/user/sign_up
(It appears to sometimes get lost on the page itsself)
### Reporting bugs
* A bug is an unintended behavior or, in the worst case, a crash.
However, it is not a bug if you believe something is missing in the
game. In this case, please read "Requesting features"
* If you report a crash, always include the error message. If you play
in singleplayer, post a screenshot of the message that Minetest showed
when the crash happened (or copy the message into your issue). If you
are a server admin, you can find error messages in the log file of the
server.
* Tell us which MineClone2 and Minetest versions you are using (from Minetest 5.7 type /ver, for previous versions, check the game.conf or README.md file).
* Tell us how to reproduce the problem: What you were doing to trigger
the bug, e.g. before the crash happened or what causes the faulty
behavior.
### Requesting features
* Ensure the requested feature fulfills our development targets and
goals.
* Begging or excessive attention seeking does not help us in the
slightest, and may very well disrupt MineClone2 development. It's better
to put that energy into helping or researching the feature in question.
After all, we're just volunteers working on our spare time.
* Ensure the requested feature has not been implemented in MineClone2
latest or development versions.
### Testing code
If you want to help us with speeding up MineClone2 development and
making the game more stable, a great way to do that is by testing out
new features from contributors. For most new things that get into the
game, a pull request is created. A pull request is essentially a
programmer saying "Look, I modified the game, please apply my changes
to the upstream version of the game". However, every programmer makes
mistakes sometimes, some of which are hard to spot. You can help by
downloading this modified version of the game and trying it out - then
tell us if the code works as expected without any issues. Ideally, you
would report issues will pull requests similar to when you were
reporting bugs that are the mainline (See Reporting bugs section). You
can find currently open pull requests here:
<https://git.minetest.land/MineClone2/MineClone2/pulls>. Note that pull
requests that start with a `WIP:` are not done yet and therefore could
still undergo substantial change. Testing these is still helpful however
because that is the reason developers put them up as WIP so other people
can have a look at the PR.
### Contributing assets
Due to license problems, MineClone2 cannot use Minecraft's assets,
therefore we are always looking for asset contributions.
To contribute assets, it can be useful to learn git basics and read
the section for Programmers of this document, however this is not required.
It's also a good idea to join the Discord server
(or alternatively IRC or Matrix).
#### Textures
For textures we prefer original art, but in the absence of that will accept
Pixel Perfection texture pack contributions. Be warned many of the newer
textures in it are copies or slight modifications of the original MC textures
so great caution needs to be taken when using any textures coming from
Minecraft texture packs.
If you want to make such contributions, join our Discord server. Demands
for textures will be communicated there.
#### Sounds
MineClone2 currently does not have a consistent way to handle sounds.
The sounds in the game come from different sources, like the SnowZone
resource pack or minetest_game. Unfortunately, MineClone2 does not play
a sound in every situation you would get one in Minecraft. Any help with
sounds is greatly appreciated, however if you add new sounds you should
probably work together with a programmer, to write the code to actually
play these sounds in game. All sounds should be released under an open
source license with clear information on the source, licencing and any
changes made by the contributor. Use the README files in the mod to
communicate this information.
#### 3D Models
Most of the 3D Models in MineClone2 come from
[22i's repository](https://github.com/22i/minecraft-voxel-blender-models).
Similar to the textures, we need people that can make 3D Models with
Blender on demand. Many of the models have to be patched, some new
animations have to be added etc.
#### Crediting
Asset contributions will be credited in their mods and their own respective
sections in CREDITS.md. If you have commited the results yourself, you will
also be credited in the Contributors section.
### Contributing Translations
#### Workflow
To add/update support for your language to MineClone2, you should take
the steps documented in the section for Programmers, add/update the
translation files of the mods that you want to update. You can add
support for all mods, just some of them or only one mod; you can update
the translation file entirely or only partly; basically any effort is
valued. If your changes are small, you can also send them to developers
via E-Mail, Discord, IRC or Matrix - they will credit you appropriately.
#### Things to note
You can use the script at `tools/check_translate_files.py` to compare
the translation files for the language you are working on with the
template files, to see what is missing and what is out of date with
the template file. However, template files are often incomplete and/or
out of date, sometimes they don't match the code. You can update the
translation files if that is required, you can also modify the code in
your translation PR if it's related to translation. You can also work on
multiple languages at the same time in one PR.
#### Crediting
Translation contributions will be credited in their own in CREDITS.md.
If you have commited the results yourself, you will also be credited in
the Contributors section.
### Profiling
If you own a server, a great way to help us improve MineClone2's code
is by giving us profiler results. Profiler results give us detailed
information about the game's performance and let us know places to
investigate optimization issues. This way we can make the game faster.
#### Using Minetest's profiler
We frequently will use profiling to optimise our code. We recommend use of
the JIT profiler (RIP Jude) to fully understand performance impact:
https://content.minetest.net/packages/jwmhjwmh/jitprofiler/
Minetest also has a built in profiler. Simply set `profiler.load = true` in
your configuration file and restart the server. After running the server
for some time, just run `/profiler save` in chat - then you will find a
file in the world directory containing the results. Open a new issue and
upload the file. You can name the issue "<Server name> profiler
results".
### Let us know your opinion
It is always encouraged to actively contribute to issue discussions on
MeseHub, let us know what you think about a topic and help us make
decisions. Also, note that a lot of discussion takes place on the
Discord server, so it's definitely worth checking it out.
### Funding
You can help pay for our infrastructure (Mesehub) by donating to our
OpenCollective link (See Links section).
### Crediting
If you opened or have contributed to an issue, you receive the
`Community` role on our Discord (after asking for it).
OpenCollective Funders are credited in their own section in
`CREDITS.md` and receive a special role "Funder" on our discord (unless
they have made their donation Incognito).
## How you can help as a programmer
(Almost) all the MineClone2 development is done using pull requests.
### Recommended workflow
* Fork the repository (in case you have not already)
* Do your change in a new branch
* Create a pull request to get your changes merged into master
* It is important that conflicts are resolved prior to merging the pull
request.
* We update our branches via rebasing. Please avoid merging master into
your branch unless it's the only way you can resolve a conflict. We can
rebase branches from the GUI if the user has not merged master into the
branch.
* After the pull request got merged, you can delete the branch if the
merger hasn't done this already.
### Discuss first
If you feel like a problem needs to fixed or you want to make a new
feature, you could start writing the code right away and notifying us
when you're done, but it never hurts to discuss things first. If there
is no issue on the topic, open one. If there is an issue, tell us that
you'd like to take care of it, to avoid duplicate work.
### Don't hesitate to ask for help
We appreciate any contributing effort to MineClone2. If you are a
relatively new programmer, you can reach us on Discord, Matrix or IRC
for questions about git, Lua, Minetest API, MineClone2 codebase or
anything related to MineClone2. We can help you avoid writing code that
would be deemed inadequate, or help you become familiar with MineClone2
better, or assist you use development tools.
### Maintain your own code, even if already got merged
Sometimes, your code may cause crashes or bugs - we try to avoid such
scenarios by testing every time before merging it, but if your merged
work causes problems, we ask you fix the issues as soon as possible.
### Changing Gameplay
Pull Requests that change gameplay have to be properly researched and
need to state their sources. These PRs also need the maintainer's approval
before they are merged.
You can use these sources:
* Testing things inside of Minecraft (Attach screenshots / video footage
of the results)
* Looking at [Minestom](https://github.com/Minestom/Minestom) code. An open source Minecraft Server implementation
* [Official Minecraft Wiki](https://minecraft.fandom.com/wiki/Minecraft_Wiki)
(Include a link to the specific page you used)
### Guidelines
#### Git Guidelines
* Pushing to master is disabled - don't even try it.
* Every change is tracked as a PR.
* All but the tiniest changes require at least one approval from a Developer
* To update branches we use rebase not merge (so we don't end up with
excessive git bureaucracy commits in master)
* We use merge to add the commits from a PR/branch to master
* Submodules should only be used if a) upstream is highly reliable and
b) it is 100% certain that no mcl2 specific changes to the code will be
needed (this has never been the case before, hence mcl2 is submodule free so far)
* Commit messages should be descriptive
* Try to group your submissions best as you can:
* Try to keep your PRs small: In some cases things reasonably be can't
split up but in general multiple small PRs are better than a big one.
* Similarly multiple small commits are better than a giant one. (use git commit -p)
#### Code Guidelines
* Each mod must provide `mod.conf`.
* Mod names are snake case, and newly added mods start with `mcl_`, e.g.
`mcl_core`, `mcl_farming`, `mcl_monster_eggs`. Keep in mind Minetest
does not support capital letters in mod names.
* To export functions, store them inside a global table named like the
mod, e.g.
```lua
mcl_example = {}
function mcl_example.do_something()
-- ...
end
```
* Public functions should not use self references but rather just access
the table directly, e.g.
```lua
-- bad
function mcl_example:do_something()
end
-- good
function mcl_example.do_something()
end
```
* Use modern Minetest API, e.g. no usage of `minetest.env`
* Tabs should be used for indent, spaces for alignment, e.g.
```lua
-- use tabs for indent
for i = 1, 10 do
if i % 3 == 0 then
print(i)
end
end
-- use tabs for indent and spaces to align things
some_table = {
{"a string", 5},
{"a very much longer string", 10},
}
```
* Use double quotes for strings, e.g. `"asdf"` rather than `'asdf'`
* Use snake_case rather than CamelCase, e.g. `my_function` rather than
`MyFunction`
* Don't declare functions as an assignment, e.g.
```lua
-- bad
local some_local_func = function()
-- ...
end
my_mod.some_func = function()
-- ...
end
-- good
local function some_local_func()
-- ...
end
function my_mod.some_func()
-- ...
end
```
### Developer status
Active and trusted contributors are often granted write access to the
MineClone2 repository as a contributor. Those that have demonstrated the right
technical skills and behaviours may be granted developer access. These are the
most trusted contributors who will contribute to ensure coding standards and
processes are followed.
#### Developer responsibilities
- If you have developer/contributor privileges you can just open a new branch
in the mcl2 repository (which is preferred). From that you create a pull request.
This way other people can review your changes and make sure they work
before they get merged.
- If you do not (yet) have developer privs you do your work on a branch
on your private repository e.g. using the "fork" function on mesehub.
- Any developer is welcome to review, test and approve PRs. A maintainer may prefer
to merge the PR especially if it is in a similar area to what has been worked on
and could result in merge conflicts for a larger older branch, or needs
art/licencing reviewing. A PR needs at least one approval (by someone else other
than the author).
- The maintainers are usually relatively quick to react to new submissions.
### Maintainer status
Maintainers carry the main responsibility for the project.
#### Maintainer responsibilities
- Making sure issues are addressed and pull requests are reviewed and
merged.
- Making releases
- Making project decisions based on community feedback
- Granting/revoking developer access
- Enforcing the code of conduct (See CODE_OF_CONDUCT.md)
- Moderating official community spaces (See Links section)
- Resolving conflicts and problems within the community
#### Current maintainers
* AncientMariner - responsible for gameplay review, publishing releases,
technical guidelines
* Nicu - responsible for community related issues
#### Release process
* Run `tools/generate_ingame_credits.lua` to update the ingame credits
from `CREDITS.md` and commit the result (if anything changed)
* Launch MineClone2 to make sure it still runs
* Update the version number in README.md
* Use `git tag <version number>` to tag the latest commit with the
version number
* Push to repository (don't forget `--tags`!)
* Update ContentDB
(https://content.minetest.net/packages/Wuzzy/mineclone2/)
* Update first post in forum thread
(https://forum.minetest.net/viewtopic.php?f=50&t=16407)
* Post release announcement and changelog in forums
### Licensing
By asking us to include your changes in this game, you agree that they
fall under the terms of the GPLv3, which basically means they will
become part of a free/libre software.
### Crediting
Contributors, Developers and Maintainers will be credited in
`CREDITS.md`. If you make your first time contribution, please add
yourself to this file. There are also Discord roles for Contributors,
Developers and Maintainers.

View File

@ -6,42 +6,39 @@
## Creator of MineClone2
* Wuzzy
## Maintainers
* AncientMariner
* Nicu
## Previous Maintainers
* Fleckenstein
* jordan4ibanez
* cora
## Developers
* bzoss
* AFCMS
* epCode
* ryvnf
* iliekprogrammar
* MysticTempest
* Rootyjr
* aligator
* Code-Sploit
* NO11
* kabou
* rudzik8
* chmodsayshello
* PrairieWind
* MrRar
* FossFanatic
* SmokeyDope
## Past Developers
* jordan4ibanez
* iliekprogrammar
* kabou
* kay27
* Faerraven / Michieal
* MysticTempest
* NO11
* RandomLegoBrick
* SumianVoice
* MrRar
* talamh
* Faerraven / Michieal
* FossFanatic
## Contributors
* RandomLegoBrick
* rudzik8
* Code-Sploit
* aligator
* Rootyjr
* ryvnf
* bzoss
* talamh
* Laurent Rocher
* HimbeerserverDE
* TechDudie
@ -70,10 +67,6 @@
* Marcin Serwin
* erlehmann
* E
* n_to
* debiankaios
* Gustavo6046 / wallabra
* CableGuy67
* Benjamin Schötz
* Doloment
* Sydney Gems
@ -88,12 +81,15 @@
* aldum
* Dieter44
* Pepebotella
* MrRar
* Lazerbeak12345
* mrminer
* Thunder1035
* opfromthestart
* snowyu
* FaceDeer
* Faerraven / Michieal
* FossFanatic
* Herbert West
* GuyLiner
* 3raven
@ -105,20 +101,27 @@
* b3nderman
* CyberMango
* gldrk
* SmokeyDope
* atomdmac
* emptyshore
* FlamingRCCars
* uqers
* Niterux
* appgurueu
* seventeenthShulker
## Music
* Jordach for the jukebox music compilation from Big Freaking Dig
* Dark Reaven Music (https://soundcloud.com/dark-reaven-music) for the main menu theme (Calmed Cube) and Traitor (horizonchris96), which is licensed under https://creativecommons.org/licenses/by-sa/3.0/
* Jester for helping to finely tune MineClone2 (https://www.youtube.com/@Jester-8-bit). Songs: Hailing Forest, Gift, 0dd BL0ck, Flock of One (License CC BY-SA 4.0)
* Exhale & Tim Unwin for some wonderful MineClone2 tracks (https://www.youtube.com/channel/UClFo_JDWoG4NGrPQY0JPD_g). Songs: Valley of Ghosts, Lonely Blossom, Farmer (License CC BY-SA 4.0)
* Diminixed for 3 fantastic tracks and remastering and leveling volumes. Songs: Afternoon Lullaby (pianowtune02), Spooled (ambientwip02), Never Grow Up (License CC BY-SA 4.0)
## MineClone5
* kay27
* Debiankaios
* epCode
* NO11
* j45
* chmodsayshello
* 3raven
* PrairieWind
* Gustavo6046 / wallabra
* CableGuy67
* MrRar
## Mineclonia
* erlehmann
* Li0n
* E
* n_to
## Original Mod Authors
* Wuzzy
@ -150,18 +153,14 @@
* 4Evergreen4
* jordan4ibanez
* paramat
* debian044 / debian44
* chmodsayshello
* cora
* Faerraven / Michieal
* PrairieWind
## 3D Models
* 22i
* tobyplowy
* epCode
* Faerraven / Michieal
* SumianVoice
## Textures
* XSSheep
@ -177,9 +176,6 @@
* cora
* Faerraven / Michieal
* Nicu
* Exhale
* Wbjitscool
* SmokeyDope
## Translations
* Wuzzy
@ -195,10 +191,6 @@
* 3raven
* SakuraRiu
* anarquimico
* syl
* Temak
* megustanlosfrijoles
* kbundg
## Funders
* 40W
@ -206,6 +198,9 @@
* Cora
## Special thanks
* The Minetest team for making and supporting an engine, and distribution infrastructure that makes this all possible
* celeron55 for creating Minetest
* Jordach for the jukebox music compilation from Big Freaking Dig
* wsor for working tirelessly in the shadows for the good of all of us, particularly helping with solving contentDB and copyright issues.
* The workaholics who spent way too much time writing for the Minecraft Wiki. It's an invaluable resource for creating this game
* Notch and Jeb for being the major forces behind Minecraft
* Notch and Jeb for being the major forces behind Minecraft
* Dark Reaven Music (https://soundcloud.com/dark-reaven-music) for the main menu theme (Calmed Cube), which is licensed under https://creativecommons.org/licenses/by-sa/3.0/

View File

@ -67,11 +67,6 @@ Please read <http://minecraft.gamepedia.com/Breaking> to learn how digging times
* `hopper=X`: Hopper (1 = downwards, 2 = sideways)
* `portal=1`: Portal (node that teleports players and things by standing inside)
* `end_portal_frame=X`: End portal frame (1 = no eye, 2 = with eye)
* `coral=X`: Coral (any type) (1 = alive, 2 = dead)
* `coral_plant=X`: Coral in the "plant" shape (1 = alive, 2 = dead)
* `coral_fan=X`: Coral fan (1 = alive, 2 = dead)
* `coral_block=X`: Coral block (1 = alive, 2 = dead)
* `coral_species=X`: Specifies the species of a coral; equal X means equal species
* `set_on_fire=X`: Sets any (not fire-resistant) mob or player on fire for X seconds when touching
* `compostability=X`: Item can be used on a composter block; X (1-100) is the % chance of adding a level of compost
* `leaves=X`: Node will spotaneously decay if no tree trunk nodes remain within 6 blocks distance.
@ -207,9 +202,6 @@ These groups are used mostly for informational purposes
* `building_block=1`: Block is a building block
* `deco_block=1`: Block is a decorational block
* `blast_furnace_smeltable=1` : Item or node is smeltable by a blast furnace
* `smoker_cookable=1` : Food is cookable by a smoker.
## Fake item groups
These groups put similar items together which should all be treated by the gameplay or the GUI as a single item.

View File

@ -1,21 +0,0 @@
Survive, farm, build, explore, play with friends, and do much more. Inspired by a well known block game, pushing beyond.
How to play:
#### Download Minetest
- Navigate to https://www.minetest.net/ to download the client.
- Once installed, open and select the "Content" tab
#### Install MineClone2 from ContentDB
- Click "Browse Online Content" and filter by Games (select "Games" from the dropdown box)
- Find "MineClone2" (should be first on the list or on the first page)
- Click the [+] button next to MineClone2 and wait for download to finish
- Click "Back to Main Menu"
#### Create new world and play
- Click "Start Game" tab
- At the bottom click the MineClone2 icon (the 2 dirt with grass blocks)
- Click "New", give your world a name
- You can leave seed blank or put in a word of your choice
- Select your new world
- Click "Play Game" and enjoy!

View File

@ -5,7 +5,7 @@ Copying is an act of love. Please copy and share! <3
Here's the detailed legalese for those who need it:
## License of source code
MineClone 2 (by Lizzy Fleckenstein, Wuzzy, davedevils and countless others)
MineClone 2 (by kay27, EliasFleckenstein, Wuzzy, davedevils and countless others)
is an imitation of Minecraft.
MineClone 2 is free software: you can redistribute it and/or modify

View File

@ -1,70 +0,0 @@
#Models in Minetest/Mineclone2
Models are an important part of all entities & unique nodes in Mineclone2. They provide a 3 dimensional map of an object for which textures are then applied to. This document is for modders, it quickly highlights some important information for the software needed to open models in Mineclone2.
## Minetest Wiki
For more detailed information on actually using blender to create and modify models for Minetest/Mineclone2, please visit the Minetest wiki's page on using Blender [Here](https://wiki.minetest.net/Using_Blender)
##Recommended software
###Blender
Blender is a very popular and free modeling software supported on Windows, MacOS, and most Linux distributions. It is recommended to use Blender to create and modify 3D models within the minetest engine.
Download blender [Here](https://www.blender.org/download/)
### .b3d addon for blender
Blitz 3D (.b3d) Is one of the main animated model formats used for entities in the minetest engine. It cannot be imported to blender without a plugin called "Import-Export:Bitz 3D format (.b3d)".
The most up to date version of this Blender plugin can be downloaded [Here](https://github.com/GreenXenith/io_scene_b3d/releases/tag/f189786)
##Types of model formats
###Animated, skinned models
* Blitz 3D files (.b3d)
* Microsoft DirectX (.x) (binary & text, compression is not supported)
###Static meshes
* Wavefront OBJ (.obj)
Note: The sometimes accompanying .mtl files are not supported and can safely be deleted.
Note: Do not use .b3d and .x files for static meshes at the moment, Minetest currently spawns animated mesh scene nodes for these, which may result in reduced performance.
### Supported texture formats
* .png
* .jpg
* .bmp (depreciated, please use .png or .jpg)
* .tga (depreciated, please use .png or .jpg)
Note: Any formats not mentioned above but known to work in the past were removed in 5.5.0 and aren't supported anymore.
##Pros & Cons of .b3d vs .x
###B3D
* [+] Binary format means a small size
* [-] Difficult to postprocess after exporting
* [-] Difficult to debug problems
###X (text version)
* [+] Can be parsed easily with lua scripts
* [+] Can be easily generated by scripts
* [+] Easy to debug issues (you can just read it)
* [+] Can be optimized by quantizing some data
* [-] Blender exporter is kinda buggy and inefficient
* [-] Probably still bigger than an equivalent .b3d
Note: Avoid using the binary X format! It's actually just a tokenized version of the ASCII representation, and may actually be less efficient than a sufficiently optimized text .x file!

View File

@ -1,173 +0,0 @@
# MineClone2
Un jeu non-officiel similaire à Minecraft pour Minetest. Forké depuis Mineclone par davedevils. Développé par de nombreuses personnes. Pas développé ni supporté par Mojang AB.
### Gameplay
Vous atterissez dans un monde fait entièrement de cubes et généré aléatoirement. Vous pouvez explorer le monde, miner et construire presque n'importe quel bloc pour créer de nouvelles structures. Vous pouvez choisir de jouer en "mode survie" dans lequel vous devez combattre des monstres et la faim et progresser lentement dans différents aspects du jeu, comme l'extraction de minerai, l'agriculture, la construction de machines et ainsi de suite. Ou alors vous pouvez jouer en "mode créatif" où vous pouvez construire à peu près n'importe quoi instantanément.
### Résumé du Gameplay
* Jeu de type bac-à-sable, sans objetifs
* Survie : combattez des monstres hostiles et la faim
* Creusez pour du minerai et d'autres trésors
* Magie : gagnez de l'expérience et enchantez les outils
* Utilisez les blocs ramassés pour construire de magnifiques bâtiments, votre imagination est la seule limite
* Ramassez des fleurs (et d'autres sources de teinture) et colorez votre monde
* Trouvez des graines et commencez à cultiver
* Trouvez ou fabriquez des centaines d'objets
* Construisez un réseau ferroviaire complexe et amusez-vous avec les wagonnets
* En mode créatif vous pouvez construire presque n'importe quoi gratuitement et sans limite
## Comment jouer (démarrer rapidement)
### Commencer
* **Frappez un arbre** jusqu'à ce qu'il casse et donne du bois
* Placez le **bois dans la grille 2x2** (la "grille de fabrication" de votre menu d'inventaire) et fabriquez 4 planches de bois
* Placer les 4 planches de bois dans la grille 2x2 et **fabriquez un établi**
* **Faites un clic droit sur l'établi** (icone livre) pour apprendre toutes les recettes possibles
* **Fabriquez une pioche de bois** pour miner la pierre
* Différents outils minent différentes sortes de blocs. Essayez-les !
* Continuez à jouer comme vous voulez. Amusez-vous !
### Agriculture
* Trouvez des graines
* Fabriquez une houe
* Faites un clic droit sur la terre ou des blocs similaires avec la houe pour créer des terres agricoles
* Placer des graines sur des terres agricoles et regardez les pousser
* Récoltez les plantes une fois matûres
* Les terres agricoles proche de l'eau deviennent humides et accélèrent la croissance
### Four
* Fabriquez un four
* Le four permet d'obtenir plus d'objets
* L'emplacement du haut doit contenir un objet fondable (par ex : minerai de fer)
* L'emplacement du bas doit contenir un objet combustible (par ex : charbon)
* Voir le guide d'artisanat pour en apprendre plus sur les objets fondables et combustibles
### Aide supplémentaire
Plus d'aide à propos du jeu, des blocs, objets et plus encore peuvent être trouvés dans le jeu. Vous pouvez accéder à l'aide depuis le menu inventaire.
### Objets spéciaux
Les objets suivants sont intéressants pour le mode Créatif et pour les constructeurs de cartes d'aventure. Ils ne peuvent être obtenus dans le jeu ou dans l'inventaire créatif.
* Barrière : `mcl_core:barrier`
Utilisez la commande de chat `/giveme` pour les obtenir. Voir l'aide interne au jeu pour une explication.
## Installation
Ce jeu nécessite [Minetest](http://minetest.net) pour fonctionner (version 5.4.1 ou plus). Vous devez donc installer Minetest d'abord. Seules les versions stables de Minetest sont officielement supportées.
Il n'y a pas de support de MineClone2 dans les versions développement de Minetest.
Pour installer MineClone2 (si ce n'est pas déjà fait), déplacez ce dossier dans le dossier “games” de Minetest. Consultez l'aide de Minetest pour en apprendre plus.
## Liens utiles
Le dépôt de MineClone2 est hébergé sur Mesehub. Pour contribuer ou signaler des problèmes, allez là-bas.
* Mesehub : <https://git.minetest.land/MineClone2/MineClone2>
* Discord : <https://discord.gg/xE4z8EEpDC>
* YouTube : <https://www.youtube.com/channel/UClI_YcsXMF3KNeJtoBfnk9A>
* IRC : <https://web.libera.chat/#mineclone2>
* Matrix : <https://app.element.io/#/room/#mc2:matrix.org>
* Reddit : <https://www.reddit.com/r/MineClone2/>
* Forums Minetest : <https://forum.minetest.net/viewtopic.php?f=50&t=16407>
* ContentDB : <https://content.minetest.net/packages/wuzzy/mineclone2/>
* OpenCollective : <https://opencollective.com/mineclone2>
## Objectif
* Essentiellement, créer un clone de Minecraft stable, moddable, libre et gratuit basé sur le moteur de jeu Minetest avec des fonctionnalités abouties, utilisable à la fois en mode solo et multijoueur. Actuellement, beaucoup des fonctionnalités de **Minecraft Java Edition** sont déjà implémentées et leur amélioration est prioritaire sur les nouvelles demandes.
* Avec une priorité moindre, implémenter les fonctionnalités des versions **Minecraft + OptiFine** (OptiFine autant que supporté par le moteur Minetest). Cela signifie que les fonctionnalités présentes dans les versions listées sont priorisées.
* Dans l'idéal, créer une expérience performante qui tourne bien sur des ordinateurs à basse performance. Malheureusement, en raison des mécanismes de Minecraft et des limitations du moteur Minetest ainsi que de la petite taille de la communauté de joueurs sur des ordinateurs à basses performances, les optimisations sont difficiles à explorer.
## Statut de complétion
Ce jeu est actuellement au stade **beta**.
Il est jouable mais incomplet en fonctionnalités.
La rétro-compatibilité n'est pas entièrement garantie, mettre votre monde à jour peut causer de petits bugs.
Si vous voulez utiliser la version de développement de MineClone2 en production, la branche master est habituellement relativement stable. Les branches de test fusionnent souvent des pull requests expérimentales et doivent être considérées comme moins stable.
Les principales fonctionnalités suivantes sont disponibles :
* Outils, armes
* Armure
* Système de fabrication : grille 2x2, établi (grille 3x3), four, incluant un guide de fabrication
* Coffres, grands coffres, coffre ender, boites de Shulker
* Fours, entonnoirs
* Faim
* La plupart des monstres et animaux
* Tous les minerais de Minecraft
* La plupart des blocs de l'overworld
* Eau et lave
* Météo
* 28 biomes + 5 biomes du Nether
* Le Nether, monde souterrain brûlant dans une autre dimension
* Circuits Redstone (partiel)
* Effets de Statut (partiel)
* Expérience
* Enchantement
* Brassage, potions, flèches trempées (partiel)
* Bâteaux
* Feu
* Blocs de construction : escaliers, dalles, portes, trappes, barrières, portillons, murets
* Horloge
* Boussole
* Éponge
* Bloc de slime
* Petites plantes et pousses
* Teintures
* Bannières
* Blocs de décoration : verre, verre teinté, vitres, barres de fer, terre cuites (et couleurs), têtes et plus
* Cadres d'objets
* Juke-boxes
* Lits
* Menu d'inventaire
* Inventaire créatif
* Agriculture
* Livres pour écrire
* Commandes
* Villages
* L'End
* et plus !
Les fonctionnalités suivantes sont incomplètes :
* Certains monstres et animaux
* Certains composants de Redstone
* Wagonnets spéciaux
* Quelques blocs et objets non-triviaux
Fonctionnalités bonus (absentes de Minecraft) :
* Guide d'artisanat intégré au jeu qui montre les recettes d'artisanat et de cuisson
* Système d'aide intégré au jeu contenant des informations à propos des techniques de base, blocs, objets et plus
* Recettes d'artisanat temporaires. Elles existent uniquement pour rendre des objets accessibles qui ne le seraient pas autrement sauf en mode créatif. Elles seront retirées au cours de l'avancement du développement et de l'ajout de nouvelles fonctionnalités.
* Pousses dans les coffres en mapgen v6
* Entièrement moddable (grâce la puissante API Lua de Minetest)
* Nouveaux blocs et objets :
* Outil de recherche, montre l'aide de ce qu'il touche
* Plus de dalles et d'escaliers
* Portillon en briques du Nether
* Barrière en briques du Nether rouges
* Portillon en briques du Nether rouges
* Structures de remplacement - ces petites variantes de structures de Minecraft servent de remplacement en attendant qu'on arrive à en faire fonctionner de plus grandes :
* Cabine dans les bois (Manoir des bois)
* Avant-poste du Nether (Forteresse)
Différences techniques avec Minecraft :
* Limite en hauteur de 31000 blocs (bien plus grand que Minecraft)
* Taille horizontale du monde 62000×62000 blocs (bien plus petit que Minecraft mais toujours très grand)
* Toujours assez incomplet et buggé
* Des blocs, objets, ennemis et fonctionnalités manquent
* Quelques objets ont des noms légèrement différents pour être plus faciles à distinguer
* Des musiques différentes pour le juke-boxe
* Des textures différentes (Pixel Perfection)
* Des sons différents (sources diverses)
* Un moteur de jeu différent (Minetest)
* Des bonus cachés différents
...et enfin MineClone2 est un logiciel libre !
## Autres fichiers readme
* `LICENSE.txt` : Le texte de la licence GPLv3
* `CONTRIBUTING.md` : Information pour ceux qui veulent contribuer
* `API.md` : Pour les modders Minetest qui veulent modder ce jeu
* `LEGAL.md` : Information légale
* `CREDITS.md` : Liste de toutes les personnes qui ont contribué

View File

@ -1,324 +0,0 @@
# MineClone 2
一個非官方的Minetest遊戲遊玩方式和Minecraft類似。由davedevils從MineClone分拆。
由許多人開發。並非由Mojang Studios開發。<!-- "Mojang AB"'s Name changed at 2020/05, main README should change too -->
版本0.71.0
### 遊玩
你開始在一個完全由方塊隨機生成的世界裡。你可以探索這個世界,挖掘和建造世界上幾乎所有的方塊,以創造新的結構。你可以選擇在「生存模式」中進行遊戲,在這個模式中,你必須與怪物戰鬥,飢餓求生,並在遊戲的其他各個環節中慢慢進步,如採礦、養殖、建造機器等等。
或者你也可以在「創造模式」中玩,在這個模式中,你可以瞬間建造大部分東西。
#### Gameplay summary
* 沙盒式遊戲,沒有明確目標
* 生存:與怪物和飢餓搏鬥
* 挖礦來獲得礦物和寶物
* 附魔:獲得經驗值並以附魔強化你的工具
* 使用收集的方塊來創造偉大的建築
* 收集鮮花(和其他染料來源),令世界多姿多彩
* 找些種子並開始耕種
* 尋找或合成數百個物品之一
* 建立一個鐵路系統,並從礦車中得到樂趣
* 用紅石電路建造複雜的機器
* 在創造模式下,你幾乎可以免費建造任何東西,而且沒有限制。
## 如何開始
### 開始生存
* **挖樹幹**直到其破裂並收集木材
* 將木頭**放入2×2的格子中**你的物品欄中的「合成格子」然後製作4塊木材。
* 將4塊木材按2×2的形狀擺放在合成格子裡製作成合成臺。
* **右鍵單擊製作臺**以獲得3×3製作網格製作更複雜的東西
* 使用**合成指南**(書形圖標)了解所有可能的合成方式
* **製作一個木鎬**,這樣你就可以挖石頭了。
* 不同的工具可以打破不同種類的方塊。試試吧!
* 繼續玩你想玩的。盡情享受吧!
### 耕種
* 找到種子
* 合成鋤頭
* 用鋤頭右鍵點擊泥土或類似的方塊,創建農田
* 將種子放在農田上,看著它們長出來
* Collect plant when fully grown
* If near water, farmland becomes wet and speeds up growth
### Furnace
* Craft furnace
* Furnace allows you to obtain more items
* Upper slot must contain a smeltable item (example: iron ore)
* Lower slot must contain a fuel item (example: coal)
* See tooltips in crafting guide to learn about fuels and smeltable items
### Additional help
More help about the gameplay, blocks items and much more can be found from inside
the game. You can access the help from your inventory menu.
### Special items
The following items are interesting for Creative Mode and for adventure
map builders. They can not be obtained in-game or in the creative inventory.
* Barrier: `mcl_core:barrier`
Use the `/giveme` chat command to obtain them. See the in-game help for
an explanation.
#### Incomplete items
These items do not work yet, but you can get them with `/giveme` for testing:
* Minecart with Chest: `mcl_minecarts:chest_minecart`
* Minecart with Furnace: `mcl_minecarts:furnace_minecart`
* Minecart with Hopper: `mcl_minecarts:hopper_minecart`
* Minecart with Command Block: `mcl_minecarts:command_block_minecart`
## Installation
This game requires [Minetest](http://minetest.net) to run (version 5.0.0 or
later). So you need to install Minetest first. Only stable versions of Minetest
are officially supported.
There is no support for running MineClone 2 in development versions of Minetest.
To install MineClone 2 (if you haven't already), move this directory into the
“games” directory of your Minetest data directory. Consult the help of
Minetest to learn more.
## Project description
The main goal of **MineClone 2** is to be a clone of Minecraft and to be released as free software.
* **開發目標:我的世界, Java版, 版本 1.12**
* MineClone2還包括Minetest支持的Optifine功能。
* 後期Minecraft版本的功能可能會偷偷加入但它們的優先級較低。
* 總的來說Minecraft的目標是在Minetest目前允許的情況下進行克隆。
* 克隆Minecraft是最優先的。
* MineClone2將使用不同的圖形和聲音但風格相似。
* 克隆界面沒有優先權。只會被粗略地模仿。
* 在Minetest中發現的局限性將在開發過程中被記錄和報告。
## 完成程度
該遊戲目前處於**alpha**階段。
它是可玩的,但尚未完成,預計會出現許多錯誤。
向後兼容性是**不能保證的**更新你的世界可能會造成大大小小的bug比如「缺少節點」的錯誤甚至崩潰
已經實現以下功能:
* 工具,武器
* 盔甲
* 合成和熔煉系統2×2 合成格, 合成臺 (3×3 合成格), 熔爐, 合成教學
* 儲物箱,大型儲物箱,終界箱和界伏盒
* 熔爐, 漏斗
* 飢餓和飽食
* 大多數怪物和動物
* Minecraft 1.12中的所有礦物<!-- Minecraft 1.17 added copper, so here must mark the version is 1.12, then main README should also add this -->
* 主世界的大部分方塊
* 水和岩漿
* 天氣
* 28個生態域
* 地獄,熾熱的維度
* 紅石電路(部分)
* 礦車(部分)
* 狀態效果(部分)
* 經驗系統
* 附魔
* 釀造,藥水,藥水箭(部分)
* 船
* 火
* 建築方塊:樓梯、半磚、門、地板門、柵欄、柵欄門、牆。
* 時鐘
* 指南針
* 海綿
* 史萊姆方塊(不與紅石互動)
* 小植物和樹苗
* 染料
* 旗幟
* 裝飾方塊:玻璃、染色玻璃、玻璃片、鐵柵欄、陶土(和染色版本)、頭顱等
* 物品展示框
* 唱片機
* 床
* 物品欄
* 創造模式物品欄
* 生產
* 書和羽毛筆
* 一些服務器命令
* 還有更多!
以下是不完整的特性:
* 生成結構(特別是村莊)
* 一些怪物和動物
* 紅石系統
* 終界
* 特殊的礦車
* 一些不簡單的方塊和物品。
額外功能在Minecraft 1.11中沒有)。
* 內置合成指南,向你展示製作和熔煉的配方
* 遊戲中的幫助系統包含了大量關於遊戲基礎知識、方塊、物品等方面的幫助。
* 臨時製作配方。它們的存在只是為了在你不在創造模式下時,提供一些其他無法獲得的物品。這些配方將隨著開發的進行和更多功能的出現而被移除。
* v6地圖生成器中箱子裡的樹苗。
* 完全可修改得益於Minetest強大的Lua API
* 新的方塊和物品:
* 查找工具,顯示觸及事物的幫助
* 更多的半磚和樓梯
* 地獄磚柵欄門
* 紅地獄磚柵欄
* 紅地獄磚柵欄門
與Minecraft的技性術差異
* 高度限制為31000格(遠高於Minecraft)
* 水平世界大小約為62000×62000格比Minecraft中的小得多但仍然非常大
* 仍然非常不完整和有問題
* 塊、物品、敵人和其他功能缺失。
* 一些項目的名稱略有不同,以便於區分。
* 唱片機的音樂不同
* 不同的材質(像素完美)
* 不同的聲音(各種來源)
* 不同的引擎Minetest
...最後MineClone2是自由軟件
## 錯誤報告
請在此處報告所有錯誤和缺少的功能:
<https://git.minetest.land/MineClone2/MineClone2/issues>
## Chating with the community
我們有Discord交流羣
<https://discord.gg/84GKcxczG3>
## Other readme files
* `LICENSE.txt`GPLv3許可文本
* `CONTRIBUTING.md`: 為那些想參與貢獻的人提供資訊
* `MISSING_ENGINE_FEATURES.md`: MineClone2需要改进Minetest中缺失的功能列表。
* `API.md`: 關於MineClone2的API
## 參與者
有這麼多人要列出抱歉。詳情請查看各mod目錄。本節只是粗略地介紹了本遊戲的核心作者。
### 程式碼
* [Wuzzy](https://forum.minetest.net/memberlist.php?mode=viewprofile&u=3082)大多數mod的主要程序員已退休
* davedevilsMineClone 2的原型——「MineClone」的創造者
* [ex-bart](https://github.com/ex-bart):紅石比較器
* [Rootyjr](https://github.com/Rootyjr):釣竿和錯誤修復
* [aligator](https://github.com/aligator):改進門
* [ryvnf](https://github.com/ryvnf):爆炸物理
* MysticTempest錯誤修復
* [bzoss](https://github.com/bzoss):狀態效果,釀造,藥水
* kay27 <kay27@bk.ru>:經驗系統,錯誤修復和優化(當前維護者)
* [EliasFleckenstein03](https://github.com/EliasFleckenstein03):終界水晶,附魔,燃燒的怪物/玩家,箱子的動畫和錯誤修復(當前維護者)
* epCode更好的玩家動畫新徽標
* 2mac修復動力鐵軌的錯誤
* 更多:待篇寫 (請查看各mod目錄)
#### Mod概括
* `controls`: Arcelmi
* `flowlib`: Qwertymine13
* `walkover`: lordfingle
* `drippingwater`: kddekadenz
* `mobs_mc`: maikerumine, 22i and others
* `awards`: rubenwardy
* `screwdriver`: RealBadAngel, Maciej Kastakin, Minetest contributors
* `xpanes`: Minetest contributors
* `mesecons` mods: Jeija and contributors
* `wieldview`: Stuart Jones
* `mcl_meshhand`: Based on `newhand` by jordan4ibanez
* `mcl_mobs`: Based on Mobs Redo [`mobs`] by TenPlus1 and contributors
* 大多其他的Mod: Wuzzy
每个mod的详细參與者可以在各个mod目录中找到。
### 圖形
* [XSSheep](http://www.minecraftforum.net/members/XSSheep)主要作者Minecraft 1.11的Pixel Perfection资源包的制作者
* [Wuzzy](https://forum.minetest.net/memberlist.php?mode=viewprofile&u=3082):主菜單圖像和各種編輯和添加的材質包
* [kingoscargames](https://github.com/kingoscargames):現有材質的各種編輯和添加
* [leorockway](https://github.com/leorockway):怪物紋理的一些編輯
* [xMrVizzy](https://minecraft.curseforge.com/members/xMrVizzy):釉陶(材質以後會被替換)
* yutyo <tanakinci2002@gmail.com>MineClone2標志
* 其他GUI圖片
### 翻譯
* Wuzzy德語
* Rocher Laurent <rocherl@club-internet.fr>:法語
* wuniversales西班牙語
* kay27 <kay27@bk.ru>:俄語
* [Emoji](https://toyshost2.ddns.net):繁體中文<!-- Hi, after the translate finish, this name should add to the main README too! -->
### 模型
* [22i](https://github.com/22i):所有模型的作者
* [tobyplowy](https://github.com/tobyplowy)對上述模型進行UV映射修復
### 聲音和音樂
多種來源。 有關詳細信息請參見相應的mod目錄。
### 特殊感謝
* Wuzzy感謝他啟動和維護MineClone2多年。
* celeron55創建Minetest。
* Minetest的社區提供了大量的mods選擇其中一些最終被納入MineClone 2。
* Jordach為《Big Freaking Dig》的唱片機音樂合輯而來
* 花了太多時間為Minecraft Wiki寫作的工作狂。它是創建這個遊戲的寶貴資源。
* Notch和Jeb是Minecraft背后的主要力量
* XSSheep用於創建Pixel Perfection資源包。
* [22i](https://github.com/22i) 提供出色的模型和支持
* [maikerumine](http://github.com/maikerumine) 揭開生物和生物群落的序幕
## 給程序員的信息
你可以在「API.md」中找到有趣和有用的信息。
## 法律信息
這是一款粉絲開發的遊戲並非由Mojang AB開發或認可。
複製是一種愛的行為。請複制和分享! <3
下面是詳細的法律條文,有需要的朋友可以參考。
### License of source code
```
MineClone 2 (by kay27, EliasFleckenstein, Wuzzy, davedevils and countless others)
is an imitation of Minecraft.
MineClone 2 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 (in the LICENSE.txt file) for more
details.
In the mods you might find in the read-me or license
text files a different license. This counts as dual-licensing.
You can choose which license applies to you: Either the
license of MineClone 2 (GNU GPLv3) or the mod's license.
MineClone 2 is a direct continuation of the discontinued MineClone
project by davedevils.
Mod credits:
See `README.txt` or `README.md` in each mod directory for information about other authors.
For mods that do not have such a file, the license is the source code license
of MineClone 2 and the author is Wuzzy.
```
### License of media (textures and sounds)
```
No non-free licenses are used anywhere.
The textures, unless otherwise noted, are based on the Pixel Perfection resource pack for Minecraft 1.11,
authored by XSSheep. Most textures are verbatim copies, while some textures have been changed or redone
from scratch.
The glazed terracotta textures have been created by (MysticTempest)[https://github.com/MysticTempest].
Source: <https://www.planetminecraft.com/texture_pack/131pixel-perfection/>
License: [CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)
The main menu images are release under: [CC0](https://creativecommons.org/publicdomain/zero/1.0/)
All other files, unless mentioned otherwise, fall under:
Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
See README.txt in each mod directory for detailed information about other authors.
```

View File

@ -1,83 +0,0 @@
### Standard Release
#File to document release steps with a view to evolving into a script
#Update CREDITS.md
#Update version in game.conf
lua tools/generate_ingame_credits.lua
git add CREDITS.md
git add mods/HUD/mcl_credits/people.lua
git add game.conf
#git add RELEASE.md
git commit -m "Pre-release update credits and set version 0.83.0"
git tag 0.83.0
git push origin 0.83.0
#Update version in game.conf to the next version with -SNAPSHOT suffix
git commit -m "Post-release set version 0.84.0-SNAPSHOT"
### Hotfix Release
##### Prepare release branch
When hotfixing, you should never release new features. Any new code increases risk of new bugs which has additional testing/release concerns.
To mitigate this, you just release the last release, and the relevant bug fix. For this, we do the following:
* Create release branch from the last release tag, push it:
git checkout -b release/0.82.1 0.82.0
git push origin release/0.82.1
##### Prepare feature branch and fix
* Create feature branch from that release branch (can review it to check only fix is there, nothing else, and use to also merge into master separately)
git checkout -b hotfix_bug_1_branch
* Fix crash/serious bug and commit
* Push branch and create pr to the release and also the master branch (Do not rebase, to reduce merge conflict risk. Do not delete after first merge or it needs to be repushed)
##### Update version and tag the release
* After all fixes are in release branch, pull it locally (best to avoid a merge conflict as feature branch will need to be merged into master also, which already changed version):
* Update version in game.conf to hotfix version and commit it. Example: version=0.82.1
* Tag it, push tag and branch:
git tag 0.82.1
git push origin 0.82.1
git push origin release/0.82.1
Note: If you have to do more than 1 hotfix release, can do it on the same release branch.
### Release via ContentDB
* Go to MineClone2 page (https://content.minetest.net/packages/Wuzzy/mineclone2/)
* Click +Release
* Enter the release tag number in the title and Git reference box. For example (without quotes): "0.82.1"
* In the minimum minetest version, put the oldest supported version (as of 14/02/2023 it is 5.5), leave the Maximum minetest version blank
* Click save. Release is now live.
##### Inform people
* Upload video to YouTube
* Add a comment to the forum post with the release number and change log. Maintainer will update main post with code link.
* Add a Discord announcement post and @everyone with link to video, forum post and release notes.
* Share the news on reddit + Lemmy. Good subs to share with:
* r/linux_gaming
* r/opensourcegames
* r/opensource
* r/freesoftware
* r/linuxmasterrace
* r/MineClone2

View File

@ -1,57 +0,0 @@
# Making Textures In Mineclone2
Textures are a crucial asset for all items, nodes, and models in mineclone2. This document is for artist who would like to make and modify textures for mineclone2. While no means comprehensive, this document contains the basic important information for beginners to get started with texture curation and optimization.
## Minetest Wiki
For more detailed information on creating and modifing texture packs for Minetest/Mineclone2, please visit the Minetest wiki's page on creating a texture pack. Click [here](https://wiki.minetest.net/Creating_texture_packs) to view the wiki page on creating texture packs.
## GIMP Tutorials Pixel Art Guide
GIMP Tutorials has an excellent guide to making pixel art in GIMP. If you would like further clarification as well as screenshots for what we are about to cover, it is an excellent resource to turn to. Click [here](https://thegimptutorials.com/how-to-make-pixel-art/) to view the guide
## Recommended Software
### GIMP
GIMP (GNU Image Manipulation Program) is a very popular and free image editing software supported on Windows, MacOS, and most Linux distributions. It is recommended to use GIMP to create and modify textures within the minetest engine.
Download GIMP [here](http://gimp.org/)
# Getting Started
## Creating a new file
the first thing to do is open GIMP and create a new file to work in by opening the File menu and choosing "New".
Choose width of 16 and height of 16 for the image size. While higher resolution textures are possible, The default size is 16x16. It is recommended you use this size as well, as it is universally supported on all systems.
## Zoom In
Next, you'll want to zoom in as the canvas is very small at the default zoom level. To do this either use CTRL + mousewheel, +/-, or navigate to the View menu > zoom > zoom in
## Configure Grid
Now, we'll want to turn on the grid. Open the edit menu and enable the 'show grid' option.
The default grid size is 10 pixels, we want to change it to a 1 pixel grid. Go to the Image menu and choose 'configure grid.
In the Spacing section, change both the Horizontal and Vertical pixel settings to 1.00 then click ok and the grid will update.
## Pencil Tool & Color Picking
The most useful brush type for pixel art is the Pencil tool. Its nested under the paintbrush tool in the toolbox, or you can use the keyboard shortcut 'N'.
Once the pencil tool is selected, navigate to the sliders on the left side of the canvas and change brush size to 1 pixel.
Now choose a color! You can do this by clicking on the two colored squares under the toolbox. The Color Picker tool is also a good option if you already have a reference image for color palette.
## How to export optimally
Once you have finished up a texture and are ready to export it, navigate to the file menu > export as... and make sure the file name extention is .png
After clicking 'Export', a menu will appear with a bunch of options checked. Make sure to uncheck all of these options!!! This will drastically reduce the file size from multiple kilobytes to a couple of hundred bytes. Finally click 'Export' one more time.
### Further optimization with OptiPNG
For those running a GNU/linux distribution, you most likely have the 'optipng' command available to you. If it does not come with your system by default, the software homepage can be found [here](https://optipng.sourceforge.net/) where you can download and install from source.
First, Open up the terminal in the directory where your exported texture is located (or navigate to the directory with the 'cd your/directory/path/to/textures'), then run this command
```
optipng -o7 -zm1-9 -nc -clobber -strip all *.png
```
This will further optimize all the textures in the directory.
NOTE: If you would like to further edit a texture that has been optipng'd in GIMP, you must manually set the color palette back to RBG after opening. Navigate to Image menu > Mode > select RGB

View File

@ -1 +0,0 @@
A survival sandbox game. Survive, gather, hunt, mine, build, explore, and do much more.

View File

@ -1,4 +1,4 @@
title = MineClone 2
title = FreeBlock
description = A survival sandbox game. Survive, gather, hunt, build, explore, and do much more.
disallowed_mapgens = v6
version=0.85.0-SNAPSHOT
version=1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -0,0 +1,20 @@
on: [push, pull_request]
name: build
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: lint
uses: Roang-zero1/factorio-mod-luacheck@master
with:
luacheckrc_url: ""
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run unit tests
uses: lunarmodules/busted@v2.1.2
with:
args: --verbose test.lua

1
mods/ADDONS/formspec_ast/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
__pycache__/

View File

@ -0,0 +1,23 @@
max_line_length = 80
globals = {
'formspec_ast',
'minetest',
}
read_globals = {
string = {fields = {'split', 'trim'}},
table = {fields = {'copy'}}
}
-- The elements.lua file is auto-generated and has a hideously long line which
-- luacheck complains about.
files["elements.lua"].ignore = {""}
-- Because formspec_ast supports running outside of MT, some string and table
-- functions are added in init.lua (unless running in MT).
files['init.lua'].globals = read_globals
-- This error is thrown for methods that don't use the implicit "self"
-- parameter.
ignore = {"212/self"}

View File

@ -0,0 +1,22 @@
# The MIT License (MIT)
Copyright © 2019 by luk3yx.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,220 @@
# formspec_ast
A Minetest mod library to make modifying formspecs easier.
## API
- `formspec_ast.parse(formspec_string)`: Parses `formspec_string` and returns
an AST.
- `formspec_ast.unparse(tree)`: Unparses the abstract syntax tree provided
and returns a formspec string.
- `formspec_ast.interpret(string_or_tree)`: Returns a formspec string after
(optionally parsing) and unparsing the formspec provided.
- `formspec_ast.walk(tree, optional_container_set)`: Returns an iterator (use this directly in a for
loop) that will return all nodes in a tree, including ones inside
containers. The containers are recognised by `type`, and can be overriden
with a table of `name` to `true` relationships in `optional_container_set`
- `formspec_ast.find(tree, node_type)`: Similar to `walk(tree)`, however only
returns `node_type` nodes.
- `formspec_ast.get_element_by_name(tree, name)`: Returns the first element in
the tree with the name `name`.
- `formspec_ast.get_elements_by_name(tree, name)`: Returns a list of all the
elements with the name `name`.
- `formspec_ast.apply_offset(tree, x, y)`: Shifts all elements in `tree`.
Similar to `container`.
- `formspec_ast.flatten(tree)`: Removes all containers and offsets elements
that were in containers accordingly. Note that `scroll_container[]`
elements are not flattened.
- `formspec_ast.show_formspec(player_or_name, formname, formspec)`: Similar
to `minetest.show_formspec`, however also accepts player objects and will
pass `formspec` through `formspec_ast.interpret` first.
- `formspec_ast.safe_parse(string_or_tree)`: Similar to `formspec_ast.parse`,
however will delete any elements that may crash the client (or any I
haven't added to the safe element list). The safe element list that this
function uses is very limited, it may break complex formspecs.
- `formspec_ast.safe_interpret(string_or_tree)`: Equivalent to
`formspec_ast.unparse(formspec_ast.safe_parse(string_or_tree))`.
- `formspec_ast.formspec_escape(text)`: The same as `minetest.formspec_escape`,
should only be used when formspec_ast is being embedded outside of Minetest.
## AST
The AST is similar (and generated from) [the formspec element list], however
all attributes are lowercase.
[the formspec element list]: https://minetest.gitlab.io/minetest/formspec/#elements
### Recent backwards incompatibilities
While I try to reduce backwards incompatibilities, sometimes they are necessary
to either fix bugs in formspec_ast or for implementing new formspec features.
#### April 2023
- The `current_tab` value of tabheader elements is now parsed as a number.
#### February 2022
- The value of scrollbars is now a number instead of a string.
- The `item`, `listelem`, and `caption` fields are now `items`, `listelems`,
and `captions`. The old names still work when unparsing formspecs for now
but are no longer used when parsing formspecs.
#### March 2021
- The `index_event` value for `dropdown` is now a boolean instead of a string.
#### February 2021
- The `close_on_enter` value for `field_close_on_enter` is now a boolean
instead of a string.
- The `frame_count`, `frame_duration` and `frame_start` values in
`animated_image` are now numbers.
#### September 2020
- The `style[]` element has a `selectors` field instead of `name`. Using
`name` when unparsing formspecs still works, however parsed formspecs
always use `selectors`.
### Special cases
- `formspec_version` (provided it is the first element) is moved to
`tree.formspec_version` (`1` by default).
### `formspec_ast.parse` example
*Note that the whitespace in the formspec is optional and exists for
readability. Non-numeric table items in the `dump()` output are re-ordered for
readability.*
```lua
> tree = formspec_ast.parse('size[5,2] '
>> .. 'style[name;bgcolor=blue;textcolor=yellow]'
>> .. 'container[1,1]'
>> .. ' label[0,0;Containers are fun]'
>> .. ' container[-1,-1]'
>> .. ' button[0.5,0;4,1;name;Label]'
>> .. ' container_end[]'
>> .. ' label[0,1;Nested containers work too.]'
>> .. 'container_end[]'
>> .. ' image[0,1;1,1;air.png]')
> print(dump(tree))
{
formspec_version = 1,
{
type = "size",
w = 5,
h = 2,
},
{
type = "style",
selectors = {"name"},
props = {
bgcolor = "blue",
textcolor = "yellow",
},
},
{
type = "container",
x = 1,
y = 1,
{
type = "label",
x = 0,
y = 0,
label = "Containers are fun",
},
{
type = "container",
x = -1,
y = -1,
{
type = "button",
x = 0.5,
y = 0,
w = 4,
h = 1,
name = "name",
label = "Label",
},
},
{
type = "label",
x = 0,
y = 1,
label = "Nested containers work too.",
},
},
{
type = "image",
x = 0,
y = 1,
w = 1,
h = 1,
texture_name = "air.png",
},
}
```
### `formspec_ast.flatten` example
```lua
> print(dump(formspec_ast.flatten(tree)))
{
formspec_version = 1,
{
type = "size",
w = 5,
h = 2,
},
{
type = "style",
selectors = {"name"},
props = {
bgcolor = "blue",
textcolor = "yellow",
},
},
{
type = "label",
x = 1,
y = 1,
label = "Containers are fun",
},
{
type = "button",
x = 0.5,
y = 0,
w = 4
h = 1,
name = "name",
label = "Label",
},
{
type = "label",
x = 1,
y = 2,
label = "Nested containers work too.",
},
{
type = "image",
x = 0,
y = 1,
w = 1,
h = 1,
texture_name = "air.png",
},
}
```
### `formspec_ast.unparse` example
```lua
> print(formspec_ast.unparse(tree))
size[5,2,]style[name;textcolor=yellow;bgcolor=blue]container[1,1]label[0,0;Containers are fun]container[-1,-1]button[0.5,0;4,1;name;Label]container_end[]label[0,1;Nested containers work too.]container_end[]image[0,1;1,1;air.png]
> print(formspec_ast.unparse(formspec_ast.flatten(tree)))
size[5,2,]style[name;textcolor=yellow;bgcolor=blue]label[1,1;Containers are fun]button[0.5,0;4,1;name;Label]label[1,2;Nested containers work too.]image[0,1;1,1;air.png]
```

View File

@ -0,0 +1,591 @@
--
-- formspec_ast: An abstract syntax tree for formspecs.
--
-- This does not actually depend on Minetest and could probably run in
-- standalone Lua.
--
-- The MIT License (MIT)
--
-- Copyright © 2019-2022 by luk3yx.
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to
-- deal in the Software without restriction, including without limitation the
-- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-- sell copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-- IN THE SOFTWARE.
--
local formspec_ast, minetest = formspec_ast, formspec_ast.minetest
local BACKSLASH, SEMICOLON, COMMA, RBRACKET = ('\\;,]'):byte(1, 4)
-- Parse a formspec into a "raw" non-AST state.
-- Input: size[5,2]button[0,0;5,1;name;Label] image[0,1;1,1;air.png]
-- Output:
-- {
-- {type='size', '5', '2'},
-- {type='button', {'0', '0'}, {'5', '1'}, 'name', 'label'},
-- {type='image', {'0', '1'}, {'1', '1'}, 'air.png'},
-- }
local table_concat = table.concat
local function raw_parse(spec)
local res = {}
local end_idx = 0
local bracket_idx
local spec_length = #spec
while end_idx < spec_length do
-- Get the element type
bracket_idx = spec:find('[', end_idx + 1, true)
if not bracket_idx then break end
local parts = {type = spec:sub(end_idx + 1, bracket_idx - 1):trim()}
-- Split everything
-- This tries and avoids creating small strings where possible
end_idx = spec_length + 1
local part = {}
local esc = false
local inner = {}
local start_idx = bracket_idx + 1
for idx = bracket_idx, spec_length do
local byte = spec:byte(idx)
if esc then
-- The current character is escaped
esc = false
elseif byte == BACKSLASH then
part[#part + 1] = spec:sub(start_idx, idx - 1)
start_idx = idx + 1
esc = true
elseif byte == SEMICOLON then
part[#part + 1] = spec:sub(start_idx, idx - 1)
start_idx = idx + 1
if #inner > 0 then
inner[#inner + 1] = table_concat(part)
parts[#parts + 1] = inner
inner = {}
else
parts[#parts + 1] = table_concat(part)
end
part = {}
elseif byte == COMMA then
part[#part + 1] = spec:sub(start_idx, idx - 1)
start_idx = idx + 1
inner[#inner + 1] = table_concat(part)
part = {}
elseif byte == RBRACKET then
end_idx = idx
break
end
end
-- Add the last part
part[#part + 1] = spec:sub(start_idx, end_idx - 1)
if #inner > 0 then
inner[#inner + 1] = table_concat(part)
parts[#parts + 1] = inner
else
parts[#parts + 1] = table_concat(part)
end
res[#res + 1] = parts
end
return res
end
-- Unparse raw formspecs
-- WARNING: This will modify the table passed to it.
local function raw_unparse(data)
local res = {}
for _, parts in ipairs(data) do
res[#res + 1] = parts.type
for i = 1, #parts do
if type(parts[i]) == 'table' then
for j, e in ipairs(parts[i]) do
parts[i][j] = minetest.formspec_escape(e)
end
parts[i] = table_concat(parts[i], ',')
else
parts[i] = minetest.formspec_escape(parts[i])
end
end
res[#res + 1] = '['
res[#res + 1] = table_concat(parts, ';')
res[#res + 1] = ']'
end
return table_concat(res)
end
-- Elements
-- The element format is currently not intuitive.
local elements = assert(loadfile(formspec_ast.modpath .. '/elements.lua'))()
-- Parsing
local types = {}
function types.undefined()
error('Unknown element type!')
end
function types.string(str)
return str
end
function types.number(raw_num)
local num = tonumber(raw_num)
assert(num and num == num, 'Invalid number: "' .. raw_num .. '".')
return num
end
function types.boolean(bool)
if bool ~= '' then
return minetest.is_yes(bool)
end
end
function types.fullscreen(param)
if param == 'both' or param == 'neither' then
return param
end
return types.boolean(param)
end
function types.table(obj)
if obj == '' then return end
local s, e = obj:find('=', nil, true)
assert(s, 'Invalid syntax: "' .. obj .. '".')
return {[obj:sub(1, s - 1)] = obj:sub(e + 1)}
end
function types.null(null)
assert(null:trim() == '', 'No value expected!')
end
local function parse_value(elems, template)
local elems_l, template_l = #elems, #template
if elems_l < template_l or (elems_l > template_l and
template_l > 0 and template[template_l][2] ~= '...') then
while #elems > #template and elems[#elems]:trim() == '' do
elems[#elems] = nil
end
assert(#elems == #template, 'Bad element length.')
end
local res = {}
if elems.type then res.type = elems.type end
for i, obj in ipairs(template) do
local val
if obj[2] == '...' then
assert(template[i + 1] == nil, 'Invalid template!')
local elems2 = {}
for j = i, #elems do
table.insert(elems2, elems[j])
end
types['...'](elems2, obj[1], res)
elseif type(obj[2]) == 'string' then
local func = types[obj[2]] or types.undefined
local elem = elems[i]
if type(elem) == 'table' then
elem = table_concat(elem, ',')
end
res[obj[1]] = func(elem, obj[1])
else
local elem = elems[i]
if type(elem) == 'string' then
elem = {elem}
end
while #obj > #elem do
table.insert(elem, '')
end
val = parse_value(elem, obj)
for k, v in pairs(val) do
res[k] = v
end
end
end
return res
end
types['...'] = function(elems, obj, res)
local template = {obj}
local val = {}
local is_string = type(obj[2]) == 'string'
for _, elem in ipairs(elems) do
local n = parse_value({elem}, template)
if is_string then
n = n[obj[1]]
end
table.insert(val, n)
end
if obj[2] == 'table' then
local t = {}
for _, n in ipairs(val) do
if n then
local k, v = next(n)
t[k] = v
end
end
res[obj[1]] = t
elseif type(obj[2]) == 'string' then
res[obj[1]] = val
else
assert(type(val) == 'table')
res[res.type or 'data'] = val
end
end
local parse_mt
local function parse_elem(elem, custom_handlers)
local data = elements[elem.type]
if not data then
if not custom_handlers or not custom_handlers[elem.type] then
return false, 'Unknown element "' .. tostring(elem.type) .. '".'
end
local parse = {}
setmetatable(parse, parse_mt)
local good, ast_elem = pcall(custom_handlers[elem.type], elem, parse)
if good and (not ast_elem or not ast_elem.type) then
good, ast_elem = false, "Function didn't return AST element!"
end
if good then
return ast_elem, true
else
return nil, 'Invalid element "' .. raw_unparse({elem}) .. '": ' ..
tostring(ast_elem)
end
end
local good, ast_elem
for _, template in ipairs(data) do
local custom_element = type(template) == 'function'
if custom_element then
good, ast_elem = pcall(template, elem)
if good and (not ast_elem or not ast_elem.type) then
good, ast_elem = false, "Function didn't return AST element!"
end
else
good, ast_elem = pcall(parse_value, elem, template)
end
if good then
return ast_elem, custom_element
end
end
return nil, 'Invalid element "' .. raw_unparse({elem}) .. '": ' ..
tostring(ast_elem)
end
-- Parse a formspec into a formspec AST.
-- Input: size[5,2] style[name;bgcolor=blue;textcolor=yellow]
-- button[0,0;5,1;name;Label] image[0,1;1,1;air.png]
-- Output:
-- {
-- formspec_version = 1,
-- {
-- type = "size",
-- w = 5,
-- h = 2,
-- },
-- {
-- type = "style",
-- name = "name",
-- props = {
-- bgcolor = "blue",
-- textcolor = "yellow",
-- },
-- },
-- {
-- type = "button",
-- x = 0,
-- y = 0,
-- w = 5,
-- h = 1,
-- name = "name",
-- label = "Label",
-- },
-- {
-- type = "image",
-- x = 0,
-- y = 1,
-- w = 1,
-- h = 1,
-- texture_name = "air.png",
-- }
-- }
function formspec_ast.parse(fs, custom_handlers)
local spec = raw_parse(fs)
local res = {formspec_version=1}
local containers = {}
local container = res
for _, elem in ipairs(spec) do
local ast_elem, err = parse_elem(elem, custom_handlers)
if not ast_elem then
return nil, err
end
table.insert(container, ast_elem)
if (ast_elem.type == 'container' or
ast_elem.type == 'scroll_container') and not err then
table.insert(containers, container)
container = ast_elem
elseif ast_elem.type == 'end' or ast_elem.type == 'container_end' or
ast_elem.type == 'scroll_container_end' then
container[#container] = nil
container = table.remove(containers)
if not container then
return nil, 'Mismatched container_end[]!'
end
end
end
if res[1] and res[1].type == 'formspec_version' then
res.formspec_version = table.remove(res, 1).version
end
return res
end
-- Unparsing
local compat_keys = {listelems = "listelem", items = "item",
captions = "caption"}
local function unparse_ellipsis(elem, obj1, res, inner)
if obj1[2] == 'table' then
local value = elem[obj1[1]]
assert(type(value) == 'table', 'Invalid AST!')
for k, v in pairs(value) do
table.insert(res, tostring(k) .. '=' .. tostring(v))
end
elseif type(obj1[2]) == 'string' then
local value = elem[obj1[1]]
if value == nil then
value = elem[compat_keys[obj1[1]]]
if value == nil then return end
end
for _, v in ipairs(value) do
table.insert(res, tostring(v))
end
else
assert(inner == nil)
local data = elem[elem.type or 'data'] or elem
for _, elem2 in ipairs(data) do
local r = {}
for _, obj2 in ipairs(obj1) do
if obj2[2] == '...' then
unparse_ellipsis(elem2, obj2[1], r, true)
elseif type(obj2[2]) == 'string' then
table.insert(r, tostring(elem2[obj2[1]]))
end
end
table.insert(res, r)
end
end
end
local function unparse_value(elem, template)
local res = {}
for i, obj in ipairs(template) do
if obj[2] == '...' then
assert(template[i + 1] == nil, 'Invalid template!')
unparse_ellipsis(elem, obj[1], res)
elseif type(obj[2]) == 'string' then
local value = elem[obj[1]]
if value == nil then
res[i] = ''
else
res[i] = tostring(value)
end
else
res[i] = unparse_value(elem, obj)
end
end
return res
end
local compare_blanks
do
local function get_nonempty(a)
if a.nonempty then
return a.nonempty, a.strings, a.total_length
end
local nonempty, strings, total_length = 0, 0, #a
for _, i in ipairs(a) do
if type(i) == 'string' and i ~= '' then
nonempty = nonempty + 1
strings = strings + 1
elseif type(i) == 'table' then
local n, s, t = get_nonempty(i)
nonempty = nonempty + n
strings = strings + s
total_length = total_length + t
end
end
a.nonempty, a.strings, a.total_length = nonempty, strings, total_length
return nonempty, strings, total_length
end
function compare_blanks(a, b)
local a_n, a_strings, a_l = get_nonempty(a)
local b_n, b_strings, b_l = get_nonempty(b)
if a_n == b_n then
if a_l == b_l then
-- Prefer elements with less tables
return a_strings > b_strings
else
return a_l < b_l
end
end
return a_n >= b_n
end
end
local function unparse_elem(elem, res, force)
if (elem.type == 'container' or
elem.type == 'scroll_container') and not force then
local err = unparse_elem(elem, res, true)
if err then return err end
for _, e in ipairs(elem) do
err = unparse_elem(e, res)
if err then return err end
end
return unparse_elem({type=elem.type .. '_end'}, res, true)
end
local data = elements[elem.type]
if not data or (not force and elem.type == 'container_end') then
return nil, 'Unknown element "' .. tostring(elem.type) .. '".'
end
local good, raw_elem
local possible_elems = {}
for _, template in ipairs(data) do
if type(template) == 'function' then
good, raw_elem = false, 'Unknown element.'
else
good, raw_elem = pcall(unparse_value, elem, template)
end
if good then
raw_elem.type = elem.type
table.insert(possible_elems, raw_elem)
end
end
-- Use the shortest element format that doesn't lose any information.
if good then
table.sort(possible_elems, compare_blanks)
table.insert(res, possible_elems[1])
else
return 'Invalid element with type "' .. tostring(elem.type)
.. '": ' .. tostring(raw_elem)
end
end
-- Convert a formspec AST back into a formspec.
-- Input:
-- {
-- {
-- type = "size",
-- w = 5,
-- h = 2,
-- },
-- {
-- type = "button",
-- x = 0,
-- y = 0,
-- w = 5,
-- h = 1,
-- name = "name",
-- label = "Label",
-- },
-- {
-- type = "image",
-- x = 0,
-- y = 1,
-- w = 1,
-- h = 1,
-- texture_name = "air.png",
-- }
-- }
-- Output: size[5,2]button[0,0;5,1;name;Label]image[0,1;1,1;air.png]
function formspec_ast.unparse(tree)
local raw_spec = {}
if tree.formspec_version and tree.formspec_version ~= 1 then
raw_spec[1] = {
type = 'formspec_version',
tostring(tree.formspec_version)
}
end
for _, elem in ipairs(tree) do
local err = unparse_elem(elem, raw_spec)
if err then
return nil, err
end
end
return raw_unparse(raw_spec)
end
-- Allow other mods to access raw_parse and raw_unparse. Note that these may
-- change or be removed at any time.
-- formspec_ast._raw_parse = raw_parse
-- formspec_ast._raw_unparse = raw_unparse
-- Register custom elements
parse_mt = {}
function parse_mt:__index(key)
if key == '...' then
key = nil
end
local func = types[key]
if func then
return function(obj)
if type(obj) == 'table' then
obj = table_concat(obj, ',')
end
return func(obj or '')
end
else
return function(_)
error('Unknown element type: ' .. tostring(key))
end
end
end
-- Register custom formspec elements.
-- `parse_func` gets two parameters: `raw_elem` and `parse`. The parse table
-- is the same as the types table above, however unknown types raise an error.
-- The function should return either a single AST node or a list of multiple
-- nodes.
-- Multiple functions can be registered for one element.
-- This API should not be used outside of formspec_ast.
function formspec_ast.register_element(name, parse_func)
assert(type(name) == 'string' and type(parse_func) == 'function')
if not elements[name] then
elements[name] = {}
end
local parse = {}
setmetatable(parse, parse_mt)
table.insert(elements[name], function(raw_elem)
local res = parse_func(raw_elem, parse)
if type(res) == 'table' and not res.type then
res.type = 'container'
res.x, res.y = 0, 0
end
return res
end)
end

View File

@ -0,0 +1,67 @@
--
-- Formspec elements list. Do not update this by hand, it is auto-generated
-- by make_elements.py.
--
local a = {}
a[1] = {"w", "number"}
a[2] = {"h", "number"}
a[3] = {a[1], a[2]}
a[4] = {{"x", "number"}, {"y", "number"}}
a[5] = {{a[4]}}
a[6] = {}
a[7] = {a[6]}
a[8] = {"scrollbar_name", "string"}
a[9] = {"orientation", "string"}
a[10] = {"inventory_location", "string"}
a[11] = {"list_name", "string"}
a[12] = {"slot_bg_normal", "string"}
a[13] = {"slot_bg_hover", "string"}
a[14] = {"slot_border", "string"}
a[15] = {"tooltip_text", "string"}
a[16] = {"bgcolor", "string"}
a[17] = {"fontcolor", "string"}
a[18] = {"gui_element_name", "string"}
a[19] = {"texture_name", "string"}
a[20] = {"middle_x", "number"}
a[21] = {"middle_y", "number"}
a[22] = {a[20], a[21], {"middle_x2", "number"}, {"middle_y2", "number"}}
a[23] = {a[20], a[21]}
a[24] = {a[20]}
a[25] = {a[4], a[3], a[19]}
a[26] = {"name", "string"}
a[27] = {"frame_count", "number"}
a[28] = {"frame_duration", "number"}
a[29] = {"frame_start", "number"}
a[30] = {"mesh", "string"}
a[31] = {{{"textures", "string"}, "..."}}
a[32] = {{"rotation_x", "number"}, {"rotation_y", "number"}}
a[33] = {"continuous", "boolean"}
a[34] = {"mouse_control", "boolean"}
a[35] = {{"frame_loop_begin", "number"}, {"frame_loop_end", "number"}}
a[36] = {"item_name", "string"}
a[37] = {"fullscreen", "fullscreen"}
a[38] = {"auto_clip", "boolean"}
a[39] = {"label", "string"}
a[40] = {{a[4], a[3], a[26], a[39]}}
a[41] = {"default", "string"}
a[42] = {a[4], a[3], a[26], a[39], a[41]}
a[43] = {{a[4], a[39]}}
a[44] = {"noclip", "boolean"}
a[45] = {"drawborder", "boolean"}
a[46] = {{a[4], a[3], a[19], a[26], a[39], a[44], a[45], {"pressed_texture_name", "string"}}, {a[4], a[3], a[19], a[26], a[39], a[44], a[45]}, {a[4], a[3], a[19], a[26], a[39]}}
a[47] = {{{"listelems", "string"}, "..."}}
a[48] = {"selected_idx", "number"}
a[49] = {"transparent", "boolean"}
a[50] = {{{"captions", "string"}, "..."}}
a[51] = {"current_tab", "number"}
a[52] = {"draw_border", "boolean"}
a[53] = {{{"items", "string"}, "..."}}
a[54] = {"index_event", "boolean"}
a[55] = {"value", "number"}
a[56] = {{"opts", "table"}, "..."}
a[57] = {{a[56]}}
a[58] = {{"props", "table"}, "..."}
a[59] = {a[26]}
a[60] = {{{{{"selectors", "string"}, "..."}}, a[58]}, {a[59], a[58]}}
return {["formspec_version"] = {{{"version", "number"}}}, ["size"] = {{a[3]}, {{a[1], a[2], {"fixed_size", "boolean"}}}}, ["position"] = a[5], ["anchor"] = a[5], ["padding"] = a[5], ["no_prepend"] = a[7], ["real_coordinates"] = {{{"bool", "boolean"}}}, ["container"] = a[5], ["container_end"] = a[7], ["scroll_container"] = {{a[4], a[3], a[8], a[9], {"scroll_factor", "number"}}, {a[4], a[3], a[8], a[9]}}, ["scroll_container_end"] = a[7], ["list"] = {{a[10], a[11], a[4], a[3], {"starting_item_index", "number"}}, {a[10], a[11], a[4], a[3]}}, ["listring"] = {{a[10], a[11]}, a[6]}, ["listcolors"] = {{a[12], a[13], a[14], {"tooltip_bgcolor", "string"}, {"tooltip_fontcolor", "string"}}, {a[12], a[13], a[14]}, {a[12], a[13]}}, ["tooltip"] = {{a[4], a[3], a[15], a[16], a[17]}, {a[4], a[3], a[15], a[16]}, {a[18], a[15], a[16], a[17]}, {a[4], a[3], a[15]}, {a[18], a[15], a[16]}, {a[18], a[15]}}, ["image"] = {{a[4], a[3], a[19], a[22]}, {a[4], a[3], a[19], a[23]}, {a[4], a[3], a[19], a[24]}, a[25]}, ["animated_image"] = {{a[4], a[3], a[26], a[19], a[27], a[28], a[29], a[22]}, {a[4], a[3], a[26], a[19], a[27], a[28], a[29], a[23]}, {a[4], a[3], a[26], a[19], a[27], a[28], a[29], a[24]}, {a[4], a[3], a[26], a[19], a[27], a[28], a[29]}, {a[4], a[3], a[26], a[19], a[27], a[28]}}, ["model"] = {{a[4], a[3], a[26], a[30], a[31], a[32], a[33], a[34], a[35], {"animation_speed", "number"}}, {a[4], a[3], a[26], a[30], a[31], a[32], a[33], a[34], a[35]}, {a[4], a[3], a[26], a[30], a[31], a[32], a[33], a[34]}, {a[4], a[3], a[26], a[30], a[31], a[32], a[33]}, {a[4], a[3], a[26], a[30], a[31], a[32]}, {a[4], a[3], a[26], a[30], a[31]}}, ["item_image"] = {{a[4], a[3], a[36]}}, ["bgcolor"] = {{a[16], a[37], {"fbgcolor", "string"}}, {a[16], a[37]}, {a[16]}}, ["background"] = {{a[4], a[3], a[19], a[38]}, a[25]}, ["background9"] = {{a[4], a[3], a[19], a[38], a[22]}, {a[4], a[3], a[19], a[38], a[23]}, {a[4], a[3], a[19], a[38], a[24]}}, ["pwdfield"] = a[40], ["field"] = {a[42], {a[26], a[39], a[41]}}, ["field_close_on_enter"] = {{a[26], {"close_on_enter", "boolean"}}}, ["textarea"] = {a[42]}, ["label"] = a[43], ["hypertext"] = {{a[4], a[3], a[26], {"text", "string"}}}, ["vertlabel"] = a[43], ["button"] = a[40], ["image_button"] = a[46], ["item_image_button"] = {{a[4], a[3], a[36], a[26], a[39]}}, ["button_exit"] = a[40], ["image_button_exit"] = a[46], ["textlist"] = {{a[4], a[3], a[26], a[47], a[48], a[49]}, {a[4], a[3], a[26], a[47], a[48]}, {a[4], a[3], a[26], a[47]}}, ["tabheader"] = {{a[4], a[2], a[26], a[50], a[51], a[49], a[52]}, {a[4], a[3], a[26], a[50], a[51], a[49], a[52]}, {a[4], a[26], a[50], a[51], a[49], a[52]}, {a[4], a[26], a[50], a[51]}}, ["box"] = {{a[4], a[3], {"color", "string"}}}, ["dropdown"] = {{a[4], a[3], a[26], a[53], a[48], a[54]}, {a[4], a[1], a[26], a[53], a[48], a[54]}, {a[4], a[3], a[26], a[53], a[48]}, {a[4], a[1], a[26], a[53], a[48]}}, ["checkbox"] = {{a[4], a[26], a[39], {"selected", "boolean"}}, {a[4], a[26], a[39]}}, ["scrollbar"] = {{a[4], a[3], a[9], a[26], a[55], {{"scrollbar_bg", "string"}, {"slider", "string"}, {"arrow_up", "string"}, {"arrow_down", "string"}}}, {a[4], a[3], a[9], a[26], a[55]}}, ["scrollbaroptions"] = a[57], ["table"] = {{a[4], a[3], a[26], {{{"cells", "string"}, "..."}}, a[48]}}, ["tableoptions"] = a[57], ["tablecolumns"] = {{{{{"type", "string"}, a[56]}, "..."}}}, ["style"] = a[60], ["style_type"] = a[60], ["set_focus"] = {{a[26], {"force", "boolean"}}, a[59]}}

View File

@ -0,0 +1,594 @@
#
# This file is automatically generated by make_elements.py and isn't actually
# used by formspec_ast, however it is useful for comparing changes across
# lua_api versions.
#
anchor:
- - - [x, number]
- [y, number]
animated_image:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [texture_name, string]
- [frame_count, number]
- [frame_duration, number]
- [frame_start, number]
- - [middle_x, number]
- [middle_y, number]
- [middle_x2, number]
- [middle_y2, number]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [texture_name, string]
- [frame_count, number]
- [frame_duration, number]
- [frame_start, number]
- - [middle_x, number]
- [middle_y, number]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [texture_name, string]
- [frame_count, number]
- [frame_duration, number]
- [frame_start, number]
- - [middle_x, number]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [texture_name, string]
- [frame_count, number]
- [frame_duration, number]
- [frame_start, number]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [texture_name, string]
- [frame_count, number]
- [frame_duration, number]
background:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [texture_name, string]
- [auto_clip, boolean]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [texture_name, string]
background9:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [texture_name, string]
- [auto_clip, boolean]
- - [middle_x, number]
- [middle_y, number]
- [middle_x2, number]
- [middle_y2, number]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [texture_name, string]
- [auto_clip, boolean]
- - [middle_x, number]
- [middle_y, number]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [texture_name, string]
- [auto_clip, boolean]
- - [middle_x, number]
bgcolor:
- - [bgcolor, string]
- [fullscreen, fullscreen]
- [fbgcolor, string]
- - [bgcolor, string]
- [fullscreen, fullscreen]
- - [bgcolor, string]
box:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [color, string]
button:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [label, string]
button_exit:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [label, string]
checkbox:
- - - [x, number]
- [y, number]
- [name, string]
- [label, string]
- [selected, boolean]
- - - [x, number]
- [y, number]
- [name, string]
- [label, string]
container:
- - - [x, number]
- [y, number]
container_end:
- []
dropdown:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- - - [items, string]
- '...'
- [selected_idx, number]
- [index_event, boolean]
- - - [x, number]
- [y, number]
- [w, number]
- [name, string]
- - - [items, string]
- '...'
- [selected_idx, number]
- [index_event, boolean]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- - - [items, string]
- '...'
- [selected_idx, number]
- - - [x, number]
- [y, number]
- [w, number]
- [name, string]
- - - [items, string]
- '...'
- [selected_idx, number]
field:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [label, string]
- [default, string]
- - [name, string]
- [label, string]
- [default, string]
field_close_on_enter:
- - [name, string]
- [close_on_enter, boolean]
formspec_version:
- - [version, number]
hypertext:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [text, string]
image:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [texture_name, string]
- - [middle_x, number]
- [middle_y, number]
- [middle_x2, number]
- [middle_y2, number]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [texture_name, string]
- - [middle_x, number]
- [middle_y, number]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [texture_name, string]
- - [middle_x, number]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [texture_name, string]
image_button:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [texture_name, string]
- [name, string]
- [label, string]
- [noclip, boolean]
- [drawborder, boolean]
- [pressed_texture_name, string]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [texture_name, string]
- [name, string]
- [label, string]
- [noclip, boolean]
- [drawborder, boolean]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [texture_name, string]
- [name, string]
- [label, string]
image_button_exit:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [texture_name, string]
- [name, string]
- [label, string]
- [noclip, boolean]
- [drawborder, boolean]
- [pressed_texture_name, string]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [texture_name, string]
- [name, string]
- [label, string]
- [noclip, boolean]
- [drawborder, boolean]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [texture_name, string]
- [name, string]
- [label, string]
item_image:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [item_name, string]
item_image_button:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [item_name, string]
- [name, string]
- [label, string]
label:
- - - [x, number]
- [y, number]
- [label, string]
list:
- - [inventory_location, string]
- [list_name, string]
- - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [starting_item_index, number]
- - [inventory_location, string]
- [list_name, string]
- - [x, number]
- [y, number]
- - [w, number]
- [h, number]
listcolors:
- - [slot_bg_normal, string]
- [slot_bg_hover, string]
- [slot_border, string]
- [tooltip_bgcolor, string]
- [tooltip_fontcolor, string]
- - [slot_bg_normal, string]
- [slot_bg_hover, string]
- [slot_border, string]
- - [slot_bg_normal, string]
- [slot_bg_hover, string]
listring:
- - [inventory_location, string]
- [list_name, string]
- []
model:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [mesh, string]
- - - [textures, string]
- '...'
- - [rotation_x, number]
- [rotation_y, number]
- [continuous, boolean]
- [mouse_control, boolean]
- - [frame_loop_begin, number]
- [frame_loop_end, number]
- [animation_speed, number]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [mesh, string]
- - - [textures, string]
- '...'
- - [rotation_x, number]
- [rotation_y, number]
- [continuous, boolean]
- [mouse_control, boolean]
- - [frame_loop_begin, number]
- [frame_loop_end, number]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [mesh, string]
- - - [textures, string]
- '...'
- - [rotation_x, number]
- [rotation_y, number]
- [continuous, boolean]
- [mouse_control, boolean]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [mesh, string]
- - - [textures, string]
- '...'
- - [rotation_x, number]
- [rotation_y, number]
- [continuous, boolean]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [mesh, string]
- - - [textures, string]
- '...'
- - [rotation_x, number]
- [rotation_y, number]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [mesh, string]
- - - [textures, string]
- '...'
no_prepend:
- []
padding:
- - - [x, number]
- [y, number]
position:
- - - [x, number]
- [y, number]
pwdfield:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [label, string]
real_coordinates:
- - [bool, boolean]
scroll_container:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [scrollbar_name, string]
- [orientation, string]
- [scroll_factor, number]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [scrollbar_name, string]
- [orientation, string]
scroll_container_end:
- []
scrollbar:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [orientation, string]
- [name, string]
- [value, number]
- - [scrollbar_bg, string]
- [slider, string]
- [arrow_up, string]
- [arrow_down, string]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [orientation, string]
- [name, string]
- [value, number]
scrollbaroptions:
- - - [opts, table]
- '...'
set_focus:
- - [name, string]
- [force, boolean]
- - [name, string]
size:
- - - [w, number]
- [h, number]
- - - [w, number]
- [h, number]
- [fixed_size, boolean]
style:
- - - - [selectors, string]
- '...'
- - [props, table]
- '...'
- - - [name, string]
- - [props, table]
- '...'
style_type:
- - - - [selectors, string]
- '...'
- - [props, table]
- '...'
- - - [name, string]
- - [props, table]
- '...'
tabheader:
- - - [x, number]
- [y, number]
- [h, number]
- [name, string]
- - - [captions, string]
- '...'
- [current_tab, number]
- [transparent, boolean]
- [draw_border, boolean]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- - - [captions, string]
- '...'
- [current_tab, number]
- [transparent, boolean]
- [draw_border, boolean]
- - - [x, number]
- [y, number]
- [name, string]
- - - [captions, string]
- '...'
- [current_tab, number]
- [transparent, boolean]
- [draw_border, boolean]
- - - [x, number]
- [y, number]
- [name, string]
- - - [captions, string]
- '...'
- [current_tab, number]
table:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- - - [cells, string]
- '...'
- [selected_idx, number]
tablecolumns:
- - - - [type, string]
- - [opts, table]
- '...'
- '...'
tableoptions:
- - - [opts, table]
- '...'
textarea:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- [label, string]
- [default, string]
textlist:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- - - [listelems, string]
- '...'
- [selected_idx, number]
- [transparent, boolean]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- - - [listelems, string]
- '...'
- [selected_idx, number]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [name, string]
- - - [listelems, string]
- '...'
tooltip:
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [tooltip_text, string]
- [bgcolor, string]
- [fontcolor, string]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [tooltip_text, string]
- [bgcolor, string]
- - [gui_element_name, string]
- [tooltip_text, string]
- [bgcolor, string]
- [fontcolor, string]
- - - [x, number]
- [y, number]
- - [w, number]
- [h, number]
- [tooltip_text, string]
- - [gui_element_name, string]
- [tooltip_text, string]
- [bgcolor, string]
- - [gui_element_name, string]
- [tooltip_text, string]
vertlabel:
- - - [x, number]
- [y, number]
- [label, string]

View File

@ -0,0 +1,226 @@
--
-- formspec_ast: An abstract syntax tree for formspecs.
--
-- This does not actually depend on Minetest and could probably run in
-- standalone Lua.
--
-- The MIT License (MIT)
--
-- Copyright © 2019-2022 by luk3yx.
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to
-- deal in the Software without restriction, including without limitation the
-- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-- sell copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-- IN THE SOFTWARE.
--
local formspec_ast, minetest = formspec_ast, formspec_ast.minetest
-- Expose minetest.formspec_escape for use outside of Minetest
formspec_ast.formspec_escape = minetest.formspec_escape
-- Parses and unparses plain formspecs and just unparses AST trees.
function formspec_ast.interpret(spec, custom_handlers)
local ast = spec
if type(spec) == 'string' then
local err
ast, err = formspec_ast.parse(spec, custom_handlers)
if not ast then
return nil, err
end
end
return formspec_ast.unparse(ast)
end
local function walk_inner(tree, container_elems)
local parents = {}
local i = 1
return function()
local res = tree[i]
while not res do
local n = table.remove(parents)
if not n then
return
end
tree, i = n[1], n[2]
res = tree[i]
end
i = i + 1
if container_elems[res.type] then
table.insert(parents, {tree, i})
tree = res
i = 1
end
return res
end
end
-- Returns an iterator over all nodes in a formspec AST, including ones in
-- containers.
local default_container_elems = {container = true, scroll_container = true}
function formspec_ast.walk(tree, provided_container_elms)
return walk_inner(tree, provided_container_elms or default_container_elems)
end
-- Similar to formspec_ast.walk(), however only returns nodes which have a type
-- of `node_type`.
function formspec_ast.find(tree, node_type)
local walk = formspec_ast.walk(tree)
return function()
local node
repeat
node = walk()
until node == nil or node.type == node_type
return node
end
end
-- Returns the first element in the AST tree that has the given name.
function formspec_ast.get_element_by_name(tree, name)
for elem in formspec_ast.walk(tree) do
if elem.name == name then
return elem
end
end
end
-- Returns a table/list/array of all elements in the AST tree that have the
-- given name.
function formspec_ast.get_elements_by_name(tree, name)
local res = {}
for elem in formspec_ast.walk(tree) do
if elem.name == name then
table.insert(res, elem)
end
end
return res
end
-- Offsets all elements in an element list.
function formspec_ast.apply_offset(elems, x, y)
x, y = x or 0, y or 0
for _, elem in ipairs(elems) do
if type(elem.x) == 'number' and type(elem.y) == 'number' then
elem.x = elem.x + x
elem.y = elem.y + y
end
end
end
-- Removes container elements and fixes nodes inside containers.
local flatten_containers = {container = true}
function formspec_ast.flatten(tree)
local res = {formspec_version=tree.formspec_version}
for elem in walk_inner(table.copy(tree), flatten_containers) do
if elem.type == 'container' then
formspec_ast.apply_offset(elem, elem.x, elem.y)
else
table.insert(res, elem)
end
end
return res
end
-- Similar to minetest.show_formspec, however is passed through
-- formspec_ast.interpret first and will return an error message if the
-- formspec could not be parsed.
function formspec_ast.show_formspec(player, formname, formspec)
if minetest.is_player(player) then
player = player:get_player_name()
end
if type(player) ~= 'string' or player == '' then
return 'No such player!'
end
local new_fs, err = formspec_ast.interpret(formspec)
if new_fs then
minetest.show_formspec(player, formname, new_fs)
else
minetest.log('warning', 'formspec_ast.show_formspec(): ' ..
tostring(err))
return err
end
end
-- Alias invsize[] to size[]
formspec_ast.register_element('invsize', function(raw, parse)
return {
type = 'size',
w = parse.number(raw[1][1]),
h = parse.number(raw[1][2]),
}
end)
-- Centered labels
-- Credit to https://github.com/v-rob/minetest_formspec_game for the click
-- animation workaround.
-- This may be removed from a later formspec_ast release.
-- size[5,2]formspec_ast:centered_label[0,0;5,1;Centered label]
formspec_ast.register_element('formspec_ast:centered_label', function(raw,
parse)
-- Create a container
return {
type = 'container',
x = parse.number(raw[1][1]),
y = parse.number(raw[1][2]),
-- Add a background-less image button with the text.
{
type = 'image_button',
x = 0,
y = 0,
w = parse.number(raw[2][1]),
h = parse.number(raw[2][2]),
texture_name = 'blank.png',
name = '',
label = parse.string(raw[3]),
noclip = true,
drawborder = false,
pressed_texture_name = '',
},
-- Add another background-less image button to hack around the click
-- animation.
{
type = 'image_button',
x = 0,
y = 0,
w = parse.number(raw[2][1]),
h = parse.number(raw[2][2]),
texture_name = '',
name = '',
label = '',
noclip = true,
drawborder = false,
pressed_texture_name = '',
},
}
end)
-- Add a formspec element to crash clients
-- This may be removed from a later formspec_ast release.
formspec_ast.register_element('formspec_ast:crash', function(_, _)
return {
type = 'list',
inventory_location = '___die',
list_name = 'crash',
x = 0,
y = 0,
w = 0,
h = 0,
}
end)

View File

@ -0,0 +1,88 @@
--
-- formspec_ast: An abstract syntax tree for formspecs.
--
-- This does not actually depend on Minetest and could probably run in
-- standalone Lua.
--
-- The MIT License (MIT)
--
-- Copyright © 2019-2022 by luk3yx.
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to
-- deal in the Software without restriction, including without limitation the
-- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-- sell copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-- IN THE SOFTWARE.
--
formspec_ast = {}
local modpath
if minetest then
-- Running inside Minetest.
formspec_ast.minetest = minetest
modpath = minetest.get_modpath('formspec_ast')
assert(minetest.get_current_modname() == 'formspec_ast',
'This mod must be called formspec_ast!')
else
-- Probably running outside Minetest.
modpath = rawget(_G, 'FORMSPEC_AST_PATH') or '.'
local minetest = {}
function minetest.is_yes(str)
str = str:lower()
return str == 'true' or str == 'yes'
end
function minetest.formspec_escape(text)
if text then
for _, n in ipairs({'\\', ']', '[', ';', ','}) do
text = text:gsub('%' .. n, '\\' .. n)
end
end
return text
end
minetest.log = print
function string.trim(str)
return str:gsub("^%s*(.-)%s*$", "%1")
end
-- Mostly copied from https://stackoverflow.com/a/26367080
function table.copy(obj, s)
if type(obj) ~= 'table' then return obj end
if s and s[obj] ~= nil then return s[obj] end
s = s or {}
local res = {}
s[obj] = res
for k, v in pairs(obj) do res[table.copy(k, s)] = table.copy(v, s) end
return res
end
formspec_ast.minetest = minetest
end
formspec_ast.modpath = modpath
dofile(modpath .. '/core.lua')
dofile(modpath .. '/helpers.lua')
formspec_ast.modpath, formspec_ast.minetest = nil, nil
-- Lazy load safety.lua because I don't think anything actually uses it
function formspec_ast.safe_parse(...)
dofile(modpath .. '/safety.lua')
return formspec_ast.safe_parse(...)
end
function formspec_ast.safe_interpret(tree)
return formspec_ast.unparse(formspec_ast.safe_parse(tree))
end

View File

@ -0,0 +1,186 @@
#!/usr/bin/env python3
#
# Converts Python objects into Lua ones. This allows more things to be used as
# keys than JSON.
#
# The MIT License (MIT)
#
# Copyright © 2019 by luk3yx.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
import collections, copy
from decimal import Decimal
def _escape_string(x):
yield '"'
for char in x:
if char == 0x22: # "
yield r'\"'
elif char == 0x5c:
yield r'\\'
elif 0x7f > char > 0x1f:
yield chr(char)
else:
yield '\\' + str(char).zfill(3)
yield '"'
class _PartialTypeError(TypeError):
def __str__(self):
return 'Object of type ' + repr(type(self.args[0]).__name__) + \
' is not Lua serializable.'
def _default_dump_func(obj):
return _dump(obj, _default_dump_func)
def _dump(obj, dump_func):
if isinstance(obj, (set, frozenset)):
obj = dict.fromkeys(obj, True)
if isinstance(obj, dict):
res = []
for k, v in obj.items():
res.append('[' + dump_func(k) + '] = ' + dump_func(v))
return '{' + ', '.join(res) + '}'
if isinstance(obj, (tuple, list)):
return '{' + ', '.join(map(dump_func, obj)) + '}'
if isinstance(obj, bool):
return 'true' if obj else 'false'
if isinstance(obj, (int, float, Decimal)):
return str(obj)
if isinstance(obj, str):
obj = obj.encode('utf-8', 'replace')
if isinstance(obj, bytes):
return ''.join(_escape_string(obj))
if obj is None:
return 'nil'
raise _PartialTypeError(obj)
def dump(obj):
"""
Similar to serialize(), however doesn't prepend return.
"""
try:
return _dump(obj, _default_dump_func)
except _PartialTypeError as e:
msg = str(e)
# Clean tracebacks
raise TypeError(msg)
def serialize(obj):
"""
Serialize an object into valid Lua code. This will raise a TypeError if the
object cannot be serialized into lua.
"""
return 'return ' + dump(obj)
def _walk(obj, seen):
yield obj
if isinstance(obj, dict):
for k, v in obj.items():
# yield from _walk(k, seen)
yield from _walk(v, seen)
elif isinstance(obj, (tuple, list, set, frozenset)):
try:
if obj in seen:
return
seen.add(obj)
except TypeError:
pass
for v in obj:
yield from _walk(v, seen)
def _replace_values(obj):
if isinstance(obj, dict):
it = obj.items()
elif isinstance(obj, list):
it = enumerate(obj)
else:
return
for k, v in it:
if isinstance(v, tuple):
new_obj = list(v)
_replace_values(new_obj)
obj[k] = tuple(new_obj)
continue
_replace_values(v)
if isinstance(v, list):
obj[k] = tuple(v)
def serialize_readonly(obj):
"""
Serializes an object into a Lua table with the assumption that the
resulting table will never be modified. This allows any duplicate lists and
tuples to be reused.
"""
# Count all tuples
ref_count = collections.Counter()
obj = copy.deepcopy(obj)
_replace_values(obj)
for item in _walk(obj, set()):
if isinstance(item, (tuple, frozenset)):
try:
ref_count[item] += 1
except TypeError:
pass
# This code is heavily inspired by MT's builtin/common/serialize.lua
# Copyright that may apply to this code (which is MIT licensed):
# @copyright 2006-2997 Fabien Fleutot <metalua@gmail.com>
dumped = {}
res = []
def dump_or_ref(obj2):
try:
count = ref_count[obj2]
except TypeError:
count = 0
if count >= 2:
if obj2 not in dumped:
code = _dump(obj2, dump_or_ref)
idx = len(res) + 1
res.append('a[{}] = {}'.format(idx, code))
dumped[obj2] = idx
return 'a[{}]'.format(dumped[obj2])
return _dump(obj2, dump_or_ref)
try:
res.append('return ' + _dump(obj, dump_or_ref))
if len(res) > 1:
res.insert(0, 'local a = {}')
return '\n'.join(res)
except _PartialTypeError as e:
msg = str(e)
# Clean tracebacks
raise TypeError(msg)

View File

@ -0,0 +1,344 @@
#!/usr/bin/env python3
#
# A primitive script to parse lua_api.txt for formspec elements.
# This script needs Python 3.8+ and ruamel.yaml to work.
#
import copy, json, lua_dump, os, re, ruamel.yaml, urllib.request
def _make_known(**kwargs):
known = {}
for k, v in kwargs.items():
for i in v:
known[i] = k
return known
_known = _make_known(
number=('x', 'y', 'w', 'h', 'selected_idx', 'version', 'current_tab',
'starting_item_index', 'scroll_factor', 'frame_count',
'frame_duration', 'frame_start', 'animation_speed', 'value'),
boolean=('auto_clip', 'fixed_size', 'transparent', 'draw_border', 'bool',
'noclip', 'drawborder', 'selected', 'force', 'close_on_enter',
'continuous', 'mouse_control', 'index_event'),
fullscreen=('fullscreen',),
table=('params', 'opts', 'props'),
null=('',),
)
def _get_name(n):
if not isinstance(n, tuple) or n[1] == '...':
return '...'
return n[0][:-1].rsplit('_', 1)[0].rstrip('_')
_aliases = {
'type': 'elem_type',
'cell': 'cells',
}
def _fix_param_name(param):
param = param.lower().strip().strip('<>').replace(' ', '_')
param = _aliases.get(param, param)
assert param != '...'
return param
def _fix_param(param):
if isinstance(param, str):
if ',' not in param:
param = _fix_param_name(param)
return (param, _known.get(param, 'string'))
param = param.split(',')
res = []
for p in map(str.strip, param):
if p != '...':
res.append(_fix_param(p))
continue
assert res
last = res.pop()
# Workaround
if res and last and isinstance(last, list) and \
last[0][0].endswith('2') and isinstance(res[-1], list) and \
res[-1] and res[-1][0][0].endswith('1'):
last = res.pop()
last[0] = (last[0][0][:-2], last[0][1])
name = _get_name(last)
if name == '...':
res.append((last, '...'))
else:
while res and _get_name(res[-1]) == name:
res.pop()
res.append((_fix_param(name + 's'), '...'))
break
return res
_hooks = {}
_passive_hooks = set()
def hook(name, *, passive=False):
if passive:
_passive_hooks.add(name)
def add_hook(func):
_hooks[name] = func
return func
return add_hook
# Fix 9-slice co-ordinates
@hook('background9')
@hook('image', passive=True)
@hook('animated_image', passive=True)
def _background9_hook(params):
if params[-1] != ('middle', 'string'):
assert ('middle', 'string') not in params
return
params[-1] = param = []
param.append(('middle_x', 'number'))
yield params
param.append(('middle_y', 'number'))
yield params
param.append(('middle_x2', 'number'))
param.append(('middle_y2', 'number'))
yield params
del params[-1]
# Fix bgcolor
@hook('bgcolor')
def _bgcolor_hook(params):
yield params
for i in range(1, len(params)):
yield params[:-i]
# Fix size
@hook('size')
def _size_hook(params):
yield params
yield [[('w', 'number'), ('h', 'number')]]
# Fix style and style_type
@hook('style')
@hook('style_type')
def _style_hook(params):
# This is not used when parsing but keeps backwards compatibility when
# unparsing.
params[0] = [('name', 'string')]
yield params
params[0] = [(('selectors', 'string'), '...')]
yield params
# Fix dropdown
@hook('dropdown', passive=True)
def _scroll_container_hook(params):
if isinstance(params[1][0], str):
params[1] = [('w', 'number'), ('h', 'number')]
else:
params[1] = ('w', 'number')
# Hooks have to return generators
return ()
# Fix textlist
@hook('textlist', passive=True)
def _textlist_hook(params):
if len(params) > 5:
yield params[:5]
return ()
# Swap order of tooltip definitions around to fix position parsing
@hook('tooltip', passive=True)
def _tooltip_hook(params):
if params[0][0] == 'gui_element_name':
params[0] = [('x', 'number'), ('y', 'number')]
params.insert(1, [('w', 'number'), ('h', 'number')])
else:
params[0] = ('gui_element_name', 'string')
del params[1]
return ()
# Work around inconsistent documentation for model[]
@hook('model')
def _model_hook(params):
# Make textures a list
assert params[4] == ('textures', 'string')
params[4] = [(('textures', 'string'), '...')]
# Fix rotation
assert params[5] == [('rotation_x', 'string'), ('y', 'number')]
params[5] = [('rotation_x', 'number'), ('rotation_y', 'number')]
# Convert frame_loop_range to frame_loop_{begin,end}
assert params[8] == ('frame_loop_range', 'string')
params[8] = [('frame_loop_begin', 'number'), ('frame_loop_end', 'number')]
# Add optional parameters
for i in range(5, len(params) + 1):
yield params[:i]
# Parse image_button/image_button_exit like the source code does
# image_button_exit[] can have the extra parameters as well and
# pressed_texture_name is optional if noclip and drawborder are specified.
@hook('image_button')
@hook('image_button_exit')
def _image_button_hook(params):
if len(params) != 5:
assert len(params) == 8
return
yield params
params.append(('noclip', 'boolean'))
params.append(('drawborder', 'boolean'))
yield params
params.append(('pressed_texture_name', 'string'))
yield params
# Work around tabheader's documentation
@hook('tabheader')
def _tabheader_hook(params):
yield params
if len(params) == 6:
assert params[4:] == [
('transparent', 'boolean'),
('draw_border', 'boolean'),
]
yield params[:4]
# Support MultiCraft's non-standard scrollbar styling
# WARNING: This may be removed or broken without notice
@hook('scrollbar')
def _scrollbar_hook(params):
assert len(params) == 5
yield params
params.append([
('scrollbar_bg', 'string'), ('slider', 'string'),
('arrow_up', 'string'), ('arrow_down', 'string')
])
yield params
_param_re = re.compile(r'^\* `([^`]+)`(?: and `([^`]+)`)?:? ')
def _raw_parse(data):
# Get everything from the elements heading to the end of the next heading
data = data.split('\nElements\n--------\n', 1)[-1].split('\n----', 1)[0]
# Remove the next heading
data = data.rsplit('\n', 1)[0]
# Get element data
for elem_data in data.split('\n### '):
lines = elem_data.split('\n')
raw_elem = lines.pop(0)
if not raw_elem.startswith('`') or not raw_elem.endswith('`'):
continue
name, params = raw_elem[1:-2].split('[', 1)
if params:
params = _fix_param(params.split(';'))
else:
params = []
if name in _hooks:
for p in reversed(tuple(map(copy.deepcopy, _hooks[name](params)))):
yield name, p
if name not in _passive_hooks:
continue
# Optional parameters
optional_params = set()
for line in lines:
match = _param_re.match(line)
if not match or 'optional' not in line.lower():
continue
optional_params.add(_fix_param_name(match.group(1)))
if p2 := match.group(2):
optional_params.add(_fix_param_name(p2))
# if optional_params:
# print('Optional', name, optional_params)
# Convert the optional parameters into a format formspec_ast can
# understand without major changes
while True:
yield name, params
if not params:
break
last_param = params[-1]
if (not isinstance(last_param, tuple) or
not isinstance(last_param[0], str) or
last_param[0] not in optional_params):
break
# print('Optional', name, last_param)
params = params[:-1]
def parse(data):
"""
Returns a dict:
{
'element_name': [
['param1', 'param2'],
['alternate_params'],
]
}
"""
res = {}
for k, v in _raw_parse(data):
if k not in res:
res[k] = []
res[k].append(v)
for v in res.values():
v.sort(key=len, reverse=True)
return res
URL = 'https://github.com/minetest/minetest/raw/master/doc/lua_api.md'
def fetch_and_parse(*, url=URL):
with urllib.request.urlopen(url) as f:
raw = f.read()
return parse(raw.decode('utf-8', 'replace'))
_comment = """
--
-- Formspec elements list. Do not update this by hand, it is auto-generated
-- by make_elements.py.
--
"""
_yaml_comment = """
#
# This file is automatically generated by make_elements.py and isn't actually
# used by formspec_ast, however it is useful for comparing changes across
# lua_api versions.
#
"""
def main():
dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, 'elements.lua')
data = fetch_and_parse()
# Horrible code to create elements.yaml
filename2 = os.path.join(dirname, 'elements.yaml')
print('Writing to ' + filename2 + '...')
with open(filename2, 'w') as f:
f.write(_yaml_comment.lstrip())
# Yuck - Unparsing then re-parsing the data as JSON is the easiest way
# I can think of to convert tuples to lists.
ruamel.yaml.dump(json.loads(json.dumps(data)), f)
print('Writing to ' + filename + '...')
with open(filename, 'w') as f:
f.write(_comment.lstrip())
f.write(lua_dump.serialize_readonly(data))
f.write('\n')
print('Done.')
if __name__ == '__main__':
main()

View File

@ -0,0 +1,6 @@
name = formspec_ast
title = Formspec AST
description = A mod library to help other mods interpret formspecs.
supported_games = *
release = 19990
author = luk3yx

View File

@ -0,0 +1,210 @@
--
-- formspec_ast: An abstract syntax tree for formspecs.
--
-- This verifies that formspecs from untrusted sources are safe(-ish) to
-- display, provided they are passed through formspec_ast.interpret.
--
-- The MIT License (MIT)
--
-- Copyright © 2019-2022 by luk3yx.
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to
-- deal in the Software without restriction, including without limitation the
-- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-- sell copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-- IN THE SOFTWARE.
--
-- Similar to ast.walk(), however returns nil if walk() would crash. Use this
-- for untrusted formspecs, otherwise use walk() for speed.
local function safe_walk(tree)
local walk = formspec_ast.walk(tree)
local seen = {}
return function()
if not walk or not seen then return end
local good, msg = pcall(walk)
if good and type(msg) == 'table' and not seen[msg] then
seen[msg] = true
return msg
end
end
end
-- Similar to ast.flatten(), however removes unsafe elements.
local function safe_flatten(tree)
local res = {formspec_version = 1}
if type(tree.formspec_version) == 'number' and
tree.formspec_version > 1 then
res.formspec_version = math.min(math.floor(tree.formspec_version), 6)
end
for elem in safe_walk(table.copy(tree)) do
if elem.type == 'container' then
if type(elem.x) == 'number' and type(elem.y) == 'number' then
formspec_ast.apply_offset(elem, elem.x, elem.y)
end
elseif elem.type then
table.insert(res, elem)
end
end
return res
end
local ensure = {}
function ensure.string(obj)
if obj == nil then
return ''
end
return tostring(obj)
end
function ensure.number(obj, max, min)
if obj == nil then return end
local res = tonumber(obj)
assert(res ~= nil and res == res)
assert(res <= (max or 100) and res >= (min or 0))
return res
end
function ensure.boolean(bool)
assert(type(bool) == "boolean" or bool == nil)
return bool
end
function ensure.integer(obj)
return math.floor(ensure.number(obj))
end
function ensure.texture(obj)
return ensure.string(obj):match("^[^%[]*")
end
function ensure.list(items)
assert(type(items) == 'table')
for k, v in pairs(items) do
assert(type(k) == 'number' and type(v) == 'string')
end
return items
end
function ensure.inventory_location(location)
assert(location == 'current_node' or location == 'current_player')
return location
end
local validate
local function validate_elem(obj)
local template = validate[obj.type]
assert(type(template) == 'table')
for k, v in pairs(obj) do
local func
if k == 'type' then
func = ensure.string
else
local value_type = template[k]
if value_type and value_type:sub(-1) == '?' then
value_type = value_type:sub(1, -2)
end
func = ensure[value_type]
end
if func then
obj[k] = func(v)
else
obj[k] = nil
end
end
for k, v in pairs(template) do
if v:sub(-1) ~= '?' then
assert(obj[k] ~= nil, k .. ' does not exist!')
end
end
end
validate = {
size = {w = 'number', h = 'number'},
label = {x = 'number', y = 'number', label = 'string'},
image = {x = 'number', y = 'number', w = 'number', h = 'number',
texture_name = 'texture'},
button = {x = 'number', y = 'number', w = 'number', h = 'number',
name = 'string', label = 'string'},
image_button = {x = 'number', y = 'number', w = 'number', h = 'number',
name = 'string', label = 'string', texture_name = 'texture',
noclip = 'string', drawborder = 'string',
pressed_texture_name = 'texture'},
item_image_button = {x = 'number', y = 'number', w = 'number',
h = 'number', name = 'string', label = 'string',
texture_name = 'texture'},
field = {x = 'number', y = 'number', w = 'number', h = 'number',
name = 'string', label = 'string', default = 'string'},
pwdfield = {x = 'number', y = 'number', w = 'number', h = 'number',
name = 'string', label = 'string'},
field_close_on_enter = {name = 'string', close_on_enter = 'string'},
textarea = {x = 'number', y = 'number', w = 'number', h = 'number',
name = 'string', label = 'string', default = 'string'},
dropdown = {
x = 'number', y = 'number', w = 'number', h = 'number?',
name = 'string', items = 'list', selected_idx = 'integer',
},
textlist = {
x = 'number', y = 'number', w = 'number', h = 'number?',
name = 'string', listelems = 'list', selected_idx = 'integer?',
transparent = 'boolean?',
},
checkbox = {x = 'number', y = 'number', name = 'string', label = 'string',
selected = 'string'},
box = {x = 'number', y = 'number', w = 'number', h = 'number',
color = 'string'},
list = {
inventory_location = 'inventory_location', list_name = 'string',
x = 'number', y = 'number', w = 'number', h = 'number',
starting_item_index = 'number?',
},
listring = {},
}
validate.vertlabel = validate.label
validate.button_exit = validate.button
validate.image_button_exit = validate.item_image_button
-- Ensure that an AST tree is safe to display. The resulting tree will be
-- flattened for simplicity.
function formspec_ast.safe_parse(tree, custom_handlers)
if type(tree) == 'string' then
tree = formspec_ast.parse(tree, custom_handlers)
end
if type(tree) ~= 'table' then
return {}
end
-- Flatten the tree and remove objects that can't possibly be elements.
tree = safe_flatten(tree)
-- Iterate over the tree and add valid elements to a new table.
local res = {formspec_version = tree.formspec_version}
for _, elem in ipairs(tree) do
local good, _ = pcall(validate_elem, elem)
if good then
res[#res + 1] = elem
end
end
return res
end

View File

@ -0,0 +1,622 @@
dofile('init.lua')
-- luacheck: read_globals assert it describe
local function test_parse(fs, expected_tree)
-- Make single elements lists and add formspec_version
if expected_tree.type then
expected_tree = {expected_tree}
end
if not expected_tree.formspec_version then
expected_tree.formspec_version = 1
end
local tree = assert(formspec_ast.parse(fs))
assert.same(tree, expected_tree)
end
local function test_parse_unparse(fs, expected_tree)
test_parse(fs, expected_tree)
local unparsed_fs = assert(formspec_ast.unparse(expected_tree))
assert.equals(fs, unparsed_fs)
end
it("can parse complex escapes", function()
test_parse_unparse([=[label[123,456;yay abc def\, ghi\; jkl mno \]\\]]=], {
formspec_version = 1,
{
type = 'label',
x = 123,
y = 456,
label = 'yay abc def, ghi; jkl mno ]\\'
}
})
end)
it("can round-trip most elements", function()
local fs = [[
formspec_version[2]
size[5,2]
padding[1,2]
no_prepend[]
container[1,1]
label[0,0;Containers are fun\]\\]
container[-1,-1]
button[0.5,0;4,1;name;Label]
container_end[]
label[0,1;Nested containers work too.]
scroll_container[0,2;1,1;scrollbar;vertical]
button[0.5,0;4,1;name;Label]
scroll_container_end[]
container_end[]
image[0,1;1,1;air.png]
set_focus[name;true]
dropdown[0,0;1;test;abc,def,ghi,jkl;2]
dropdown[0,0;1;test;abc,def,ghi,jkl;2;true]
field_close_on_enter[my-field;false]
bgcolor[blue]
bgcolor[blue;true]
bgcolor[blue;both;green]
tooltip[1,2;3,4;text]
tooltip[elem;text;bgcolor]
background9[1,2;3,4;bg.png;false;5]
background9[1,2;3,4;bg.png;false;5,6]
background9[1,2;3,4;bg.png;false;5,6,7,8]
tablecolumns[text;image;color,option=value;tree]
list[test;test2;1,2;3,4;5]
list[test6;test7;8,9;10,11]
image_button[1,2;3,4;img.png;name;label]
image_button[1,2;3,4;img.png;name;label;false;true]
image_button[1,2;3,4;img.png;name;label;true;false;img2.png]
image_button_exit[1,2;3,4;img.png;name;label]
image_button_exit[1,2;3,4;img.png;name;label;false;true]
image_button_exit[1,2;3,4;img.png;name;label;true;false;img2.png]
image[1,2;3,4;air.png;5]
image[1,2;3,4;air.png;5,6]
image[1,2;3,4;air.png;5,6,7,8]
]]
fs = ('\n' .. fs):gsub('\n[ \n]*', '')
test_parse_unparse(fs, {
formspec_version = 2,
{
type = "size",
w = 5,
h = 2,
},
{
type = "padding",
x = 1,
y = 2,
},
{
type = "no_prepend"
},
{
type = "container",
x = 1,
y = 1,
{
type = "label",
x = 0,
y = 0,
label = "Containers are fun]\\",
},
{
type = "container",
x = -1,
y = -1,
{
type = "button",
x = 0.5,
y = 0,
w = 4,
h = 1,
name = "name",
label = "Label",
},
},
{
type = "label",
x = 0,
y = 1,
label = "Nested containers work too.",
},
{
type = "scroll_container",
x = 0,
y = 2,
w = 1,
h = 1,
scrollbar_name = "scrollbar",
orientation = "vertical",
-- scroll_factor = nil,
{
h = 1,
y = 0,
label = "Label",
w = 4,
name = "name",
x = 0.5,
type = "button"
},
},
},
{
type = "image",
x = 0,
y = 1,
w = 1,
h = 1,
texture_name = "air.png",
},
{
type = "set_focus",
name = "name",
force = true,
},
{
type = "dropdown",
x = 0,
y = 0,
w = 1,
name = "test",
items = {"abc", "def", "ghi", "jkl"},
selected_idx = 2,
},
{
type = "dropdown",
x = 0,
y = 0,
w = 1,
name = "test",
items = {"abc", "def", "ghi", "jkl"},
selected_idx = 2,
index_event = true,
},
{
type = "field_close_on_enter",
name = "my-field",
close_on_enter = false,
},
{
type = "bgcolor",
bgcolor = "blue",
},
{
type = "bgcolor",
bgcolor = "blue",
fullscreen = true,
},
{
type = "bgcolor",
bgcolor = "blue",
fullscreen = "both",
fbgcolor = "green",
},
{
type = "tooltip",
x = 1,
y = 2,
w = 3,
h = 4,
tooltip_text = "text",
},
{
type = "tooltip",
gui_element_name = "elem",
tooltip_text = "text",
bgcolor = "bgcolor",
},
{
type = "background9",
x = 1,
y = 2,
w = 3,
h = 4,
texture_name = "bg.png",
auto_clip = false,
middle_x = 5,
},
{
type = "background9",
x = 1,
y = 2,
w = 3,
h = 4,
texture_name = "bg.png",
auto_clip = false,
middle_x = 5,
middle_y = 6,
},
{
type = "background9",
x = 1,
y = 2,
w = 3,
h = 4,
texture_name = "bg.png",
auto_clip = false,
middle_x = 5,
middle_y = 6,
middle_x2 = 7,
middle_y2 = 8,
},
{
type = "tablecolumns",
tablecolumns = {
{type = "text", opts = {}},
{type = "image", opts = {}},
{type = "color", opts = {option = "value"}},
{type = "tree", opts = {}},
},
},
{
type = "list",
inventory_location = "test",
list_name = "test2",
x = 1,
y = 2,
w = 3,
h = 4,
starting_item_index = 5,
},
{
type = "list",
inventory_location = "test6",
list_name = "test7",
x = 8,
y = 9,
w = 10,
h = 11,
},
{
type = "image_button",
x = 1,
y = 2,
w = 3,
h = 4,
texture_name = "img.png",
name = "name",
label = "label",
},
{
type = "image_button",
x = 1,
y = 2,
w = 3,
h = 4,
texture_name = "img.png",
name = "name",
label = "label",
noclip = false,
drawborder = true,
},
{
type = "image_button",
x = 1,
y = 2,
w = 3,
h = 4,
texture_name = "img.png",
name = "name",
label = "label",
noclip = true,
drawborder = false,
pressed_texture_name = "img2.png",
},
{
type = "image_button_exit",
x = 1,
y = 2,
w = 3,
h = 4,
texture_name = "img.png",
name = "name",
label = "label",
},
{
type = "image_button_exit",
x = 1,
y = 2,
w = 3,
h = 4,
texture_name = "img.png",
name = "name",
label = "label",
noclip = false,
drawborder = true,
},
{
type = "image_button_exit",
x = 1,
y = 2,
w = 3,
h = 4,
texture_name = "img.png",
name = "name",
label = "label",
noclip = true,
drawborder = false,
pressed_texture_name = "img2.png",
},
{
type = "image",
x = 1,
y = 2,
w = 3,
h = 4,
texture_name = "air.png",
middle_x = 5,
},
{
type = "image",
x = 1,
y = 2,
w = 3,
h = 4,
texture_name = "air.png",
middle_x = 5,
middle_y = 6,
},
{
type = "image",
x = 1,
y = 2,
w = 3,
h = 4,
texture_name = "air.png",
middle_x = 5,
middle_y = 6,
middle_x2 = 7,
middle_y2 = 8,
},
})
end)
local function remove_trailing_params(elem_s, elem, ...)
local res = {}
local strings = {}
local optional_params = {...}
for i = #optional_params, 1, -1 do
local p = optional_params[i]
local no_copy = {}
if type(p) == "table" then
for _, param in ipairs(p) do
no_copy[param] = true
end
else
no_copy[p] = true
end
res[i] = elem
strings[i] = elem_s
elem_s = elem_s:gsub(";[^;]+%]$", "]")
local old_elem = elem
elem = {}
for k, v in pairs(old_elem) do
if not no_copy[k] then
elem[k] = v
end
end
end
return table.concat(strings, ""), res
end
it("can parse model[]", function()
test_parse_unparse(remove_trailing_params(
"model[1,2;3,4;abc;def;ghi,jkl;5,6;true;false;7,8;9]",
{
type = "model",
x = 1,
y = 2,
w = 3,
h = 4,
name = "abc",
mesh = "def",
textures = {"ghi", "jkl"},
rotation_x = 5,
rotation_y = 6,
continuous = true,
mouse_control = false,
frame_loop_begin = 7,
frame_loop_end = 8,
animation_speed = 9
},
{"rotation_x", "rotation_y"}, "continuous", "mouse_control",
{"frame_loop_begin", "frame_loop_end"}, "animation_speed"
))
end)
it("can round-trip style[]", function()
local s = 'style[test1,test2;def=ghi]style_type[test;abc=def]'
assert.equals(s, assert(formspec_ast.interpret(s)))
test_parse('style[name,name2;bgcolor=blue;textcolor=yellow]', {
type = "style",
selectors = {
"name",
"name2",
},
props = {
bgcolor = "blue",
textcolor = "yellow",
},
})
end)
-- Test item/items compatibility
it("can parse dropdown[]", function()
local expected = 'dropdown[0,0;1,2;test;abc,def,ghi,jkl;2;true]'
assert.equals(
expected,
assert(formspec_ast.unparse({
{
type = "dropdown",
x = 0,
y = 0,
w = 1,
h = 2,
name = "test",
items = {"abc", "def", "ghi", "jkl"},
selected_idx = 2,
index_event = true,
},
}))
)
assert.equals(
expected,
assert(formspec_ast.unparse({
{
type = "dropdown",
x = 0,
y = 0,
w = 1,
h = 2,
name = "test",
item = {"abc", "def", "ghi", "jkl"},
selected_idx = 2,
index_event = true,
},
}))
)
end)
-- Ensure the style[] unparse compatibility works correctly
it("can unparse style with name", function()
local expected = 'style_type[test;abc=def]'
assert.equals(
expected,
assert(formspec_ast.unparse({
{
type = 'style_type',
name = 'test',
props = {
abc = 'def',
},
}
}))
)
assert.equals(
expected,
assert(formspec_ast.unparse({
{
type = 'style_type',
selectors = {
'test',
},
props = {
abc = 'def',
},
}
}))
)
end)
-- Ensure flatten works correctly
it("flattens formspecs correctly", function()
assert.equals(
'label[0,0;abc]label[2,2;def]scroll_container[1,1;2,2;test;vertical]' ..
'image[1,1;1,1;def]scroll_container_end[]',
formspec_ast.unparse(formspec_ast.flatten(assert(formspec_ast.parse([[
label[0,0;abc]
container[3,2]
container[-1,0]
label[0,0;def]
container_end[]
container_end[]
scroll_container[1,1;2,2;test;vertical]
image[1,1;1,1;def]
scroll_container_end[]
]]))))
)
end)
it("interprets invsize[] and escapes correctly", function()
assert.equals(assert(formspec_ast.interpret('invsize[12,34]')),
'size[12,34]')
assert.equals(assert(formspec_ast.interpret('label[1,2;abc\\')),
'label[1,2;abc]')
assert.equals(assert(formspec_ast.interpret('label[1,2;abc\\\\')),
'label[1,2;abc\\\\]')
assert.equals(formspec_ast.formspec_escape('label[1,2;abc\\def]'),
'label\\[1\\,2\\;abc\\\\def\\]')
end)
it("safe_interpret", function()
assert.equals(
formspec_ast.safe_interpret([[
formspec_version[5.1]
size[3,3]
label[0,0;Hi]
image[1,2;3,4;a^b\[c]
formspec_ast:crash[]
textlist[1,2;3,4;test;a,b,c]
]]),
'formspec_version[5]size[3,3]label[0,0;Hi]image[1,2;3,4;a^b]' ..
'textlist[1,2;3,4;test;a,b,c]'
)
end)
it("can parse tabheader", function()
local fs =
"tabheader[1,2;name;a,b,c;1]" ..
"tabheader[1,2;name;a,b,c;1;false;true]" ..
-- Width and height can only be specified if transparent and drawborder
-- are specified
"tabheader[1,2;3,4;name;a,b,c;1;false;true]" ..
"tabheader[1,2;3;name;a,b,c;1;false;true]" ..
"tabheader[1,2;3;name;a,b,c;1;;]"
test_parse_unparse(fs, {
{
type = "tabheader",
x = 1, y = 2,
name = "name",
captions = {"a", "b", "c"},
current_tab = 1
},
{
type = "tabheader",
x = 1, y = 2,
name = "name",
captions = {"a", "b", "c"},
current_tab = 1,
transparent = false,
draw_border = true
},
{
type = "tabheader",
x = 1, y = 2, w = 3, h = 4,
name = "name",
captions = {"a", "b", "c"},
current_tab = 1,
transparent = false,
draw_border = true
},
{
type = "tabheader",
x = 1, y = 2, h = 3,
name = "name",
captions = {"a", "b", "c"},
current_tab = 1,
transparent = false,
draw_border = true
},
{
type = "tabheader",
x = 1, y = 2, h = 3,
name = "name",
captions = {"a", "b", "c"},
current_tab = 1,
},
})
end)
it("does not parse invalid tabheader elements", function()
assert.is_nil(formspec_ast.parse("tabheader[1,2;name;a,b,c]"))
assert.is_nil(formspec_ast.parse("tabheader[1,2;name;a,b,c;1;false]"))
assert.is_nil(formspec_ast.parse("tabheader[1,2;3,4;name;a,b,c;1]"))
end)

41
mods/ADDONS/mcl_autocrafter/.gitignore vendored Normal file
View File

@ -0,0 +1,41 @@
# Compiled Lua sources
luac.out
# luarocks build files
*.src.rock
*.zip
*.tar.gz
# Object files
*.o
*.os
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
*.def
*.exp
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

View File

@ -0,0 +1,11 @@
{
"Lua.diagnostics.globals": [
"minetest",
"mcl_autocrafter",
"mcl_util",
"ItemStack",
"mcl_formspec",
"mcl_sounds",
"vector"
]
}

View File

@ -0,0 +1,23 @@
The original code, pipeworks, is licensed under LGPLv3. However, due to the license requirements of MineClone2, the license of this mod is GPLv3. The media are authored by VanessaE, licensed under CC BY-SA 4.0.
GPL License:
mcl_autocrafter: Automated crafting on MineClone2
Copyright (C) 20218-2021 VanessaE
Copyright (C) 2023 1F616EMO
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 <https://www.gnu.org/licenses/>.
CC BY-SA 4.0 License: https://creativecommons.org/licenses/by-sa/4.0/
As this mod use hacks to workaround hopper issues, only MineClone2 is supported and no forks of it are supported.

View File

@ -0,0 +1,7 @@
# Intergrate crafting into your hopper-based machines
This mod provides autocrafters for MineClone2. Hoppers connected on top or on the sides will be inputting to the crafting materials grid. The hopper below will be taking items from the autocrafter's output.
The original code, [`pipeworks`](https://github.com/mt-mods/pipeworks), is licensed under LGPLv3. However, due to the license requirements of MineClone2, the license of this mod is GPLv3. The media are authored by VanessaE, licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).
As this mod use hacks to workaround hopper issues, only MineClone2 is supported and no forks of it are supported.

View File

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

View File

@ -0,0 +1,482 @@
--[[
mcl_autocrafter: Automated crafting on MineClone2
Copyright (C) 20218-2021 VanessaE
Copyright (C) 2023 1F616EMO
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 <https://www.gnu.org/licenses/>.
]]
local MP = minetest.get_modpath("mcl_autocrafter")
local S = minetest.get_translator("mcl_autocrafter")
local craft_time = 1
mcl_autocrafter = {}
-- [pos hash] = {consumption = {[Item Name] = [int],...}, output = {[ItemStack],...}, main_output = [ItemStack], last_use = [os.time()]}
local crafting_cache = {}
function mcl_autocrafter.count_index(invtable)
local index = {}
for _, stack in ipairs(invtable) do
if not stack:is_empty() then
local stack_name = stack:get_name()
index[stack_name] = (index[stack_name] or 0) + stack:get_count()
end
end
return index
end
function mcl_autocrafter.get_craft_for(pos,force_refresh)
local pos_hash = minetest.hash_node_position(pos)
if not(crafting_cache[pos_hash]) or force_refresh then
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local recipe = inv:get_list("recipe")
local output, decremented_input = minetest.get_craft_result({method = "normal", width = 3, items = recipe})
if output.item:is_empty() then
crafting_cache[pos_hash] = nil
return false
end
local output_table = {}
table.insert(output_table,output.item)
for _,v in ipairs(output.replacements) do
table.insert(output_table,v[2])
end
for _,v in ipairs(decremented_input) do
table.insert(output_table,v)
end
crafting_cache[pos_hash] = {
consumption = mcl_autocrafter.count_index(recipe),
output = mcl_autocrafter.count_index(output_table),
main_output = output.item
}
end
crafting_cache[pos_hash].last_used = os.time()
return crafting_cache[pos_hash]
end
-- loops: number of maximum crafts to be done
function mcl_autocrafter.do_autocraft_on(pos,loops,craft,force_refresh)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
craft = craft or mcl_autocrafter.get_craft_for(pos,force_refresh)
if not craft then
return false, "NO_VALID_CRAFT"
end
local src_final = {}
local times_final = 0
local output_final = {}
do
local i = 0
local broken = false
while (i < loops) and not(broken) do
i = i + 1
local src_timed = {}
for k,v in pairs(craft.consumption) do
src_timed[k] = (i == 1) and v or (v * i)
end
local output_timed = {}
for k,v in pairs(craft.output) do
output_timed[k] = (i == 1) and v or (v * i)
end
for k,v in pairs(src_timed) do
local stack = ItemStack(k)
stack:set_count(v)
if not inv:contains_item("src", stack, false) then
broken = true
end
end
if not broken then
for k,v in pairs(output_timed) do
local stack = ItemStack(k)
stack:set_count(v)
if not inv:room_for_item("dst",stack) then
broken = true
end
end
if not broken then
src_final = src_timed
output_final = output_timed
times_final = i
end
end
end -- Do not exceed the given limit
end
if times_final <= 0 then
return false, "NOT_ENOUGH_SPACE" -- We do not craft void
end
-- Consume materieal
for name, number in pairs(src_final) do
local stack_max = minetest.registered_items[name] and minetest.registered_items[name].stack_max or 99
while number > 0 do -- We have to do that since remove_item does not work if count > stack_max
local number_take = math.min(number,stack_max)
number = number - number_take
inv:remove_item("src",name .. " " .. number_take)
end
end
-- Craft and add to dst
for k,v in pairs(output_final) do
inv:add_item("dst",k .. " " .. v)
end
return true
end
function mcl_autocrafter.make_formspec(state)
return "" ..
"size[9,12]" ..
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Recipe grid"))).."]" ..
"list[context;recipe;0,0.5;3,3]" ..
mcl_formspec.get_itemslot_bg(0,0.5,3,3) ..
"list[context;output;3.5,1.5;1,1]" ..
mcl_formspec.get_itemslot_bg(3.5,1.5,1,1) ..
"image_button[3.5,2.7;1,0.6;pipeworks_button_" .. state .. ".png;" .. state .. ";;;false;pipeworks_button_interm.png]" ..
"label[5,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Output"))).."]" ..
"list[context;dst;5,0.5;4,3;]" ..
mcl_formspec.get_itemslot_bg(5,0.5,4,3) ..
"label[0,3.5;"..minetest.formspec_escape(minetest.colorize("#313131", S("Crafting materieals"))).."]" ..
"list[context;src;0,4;9,3;]" ..
mcl_formspec.get_itemslot_bg(0,4,9,3) ..
"label[0,7;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]" ..
"list[current_player;main;0,7.5;9,3;9]" ..
mcl_formspec.get_itemslot_bg(0,7.5,9,3) ..
"list[current_player;main;0,11;9,1;]" ..
mcl_formspec.get_itemslot_bg(0,11,9,1) ..
"listring[current_player;main]" ..
"listring[context;src]" ..
"listring[current_player;main]" ..
"listring[context;dst]" ..
"listring[current_player;main]"
end
function mcl_autocrafter.get_infotext(output,state)
local output_string = S("Unconfigured")
if output and not(output:is_empty()) then
output_string = output:get_short_description()
elseif state == "UNCONFIGURED" then
return S("Autocrafter: @1", output_string)
end
local state_string = "ERROR"
if state == "OK" then
state_string = S("Runnning")
elseif state == "NOT_ENOUGH_SPACE" then
local paused_string = S("Not enough inventory space or materieals.")
state_string = S("Paused: @1",paused_string)
elseif state == "NO_VALID_CRAFT" then
state_string = S("Unconfigured.")
elseif state == "STOPPED" then
state_string = S("Stopped.")
end
return S("Autocrafter: @1",output_string) .. "\n" .. state_string
end
local function after_dig_node(pos,node,oldmetadata)
mcl_autocrafter.drop_all(pos,node,oldmetadata)
local timer = minetest.get_node_timer(pos)
if timer:is_started() then
timer:stop()
end
end
function mcl_autocrafter.start_autocrafter(pos)
local meta = minetest.get_meta(pos)
if meta:get_int("enabled") == 1 then
local timer = minetest.get_node_timer(pos)
if not timer:is_started() then
timer:start(craft_time)
end
end
end
function mcl_autocrafter.after_recipe_change(pos, inv)
local meta = minetest.get_meta(pos)
if not inv then
inv = meta:get_inventory()
end
if inv:is_empty("recipe") then -- Nothing to do
minetest.log("action",string.format("[mcl_autocrafter] Recipe of autocrafter at %s is cleared",minetest.pos_to_string(pos)))
local timer = minetest.get_node_timer(pos)
if timer:is_started() then
timer:stop()
end
local pos_hash = minetest.hash_node_position(pos)
crafting_cache[pos_hash] = nil
meta:set_string("infotext",mcl_autocrafter.get_infotext(nil,"UNCONFIGURED"))
return
end
local craft = mcl_autocrafter.get_craft_for(pos,true) -- Force-refresh the cached recipe
if craft then
meta:set_string("infotext",mcl_autocrafter.get_infotext(craft.main_output,"OK"))
inv:set_stack("output", 1, craft.main_output)
else
meta:set_string("infotext",mcl_autocrafter.get_infotext(nil,"NO_VALID_CRAFT"))
end
mcl_autocrafter.start_autocrafter(pos)
end
-- HACK! Forcely change "fuel" to "src" for autocrafters
-- The source and destination inventories should NEVER EVER BE HARDCODED INTO THE SOURCECODE!
do
local old_move_item_container = mcl_util.move_item_container
function mcl_util.move_item_container(source_pos, destination_pos, source_list, source_stack_id, destination_list)
local dest_node = minetest.get_node(destination_pos)
if dest_node.name == "mcl_autocrafter:autocrafter" and destination_list == "fuel" then
-- FORCEly change it back to "src"
destination_list = "src"
end
return old_move_item_container(source_pos, destination_pos, source_list, source_stack_id, destination_list)
end
local old_get_eligible_transfer_item_slot = mcl_util.get_eligible_transfer_item_slot
function mcl_util.get_eligible_transfer_item_slot(src_inventory, src_list, dst_inventory, dst_list, condition)
local dst_inv_location = dst_inventory:get_location()
if dst_inv_location.type == "node" then
local dest_node = minetest.get_node(dst_inv_location.pos)
if dest_node.name == "mcl_autocrafter:autocrafter" and dst_list == "fuel" then
-- FORCEly change it back to "src"
dst_list = "src"
-- Hey, no conditions!
condition = nil
end
end
return old_get_eligible_transfer_item_slot(src_inventory, src_list, dst_inventory, dst_list, condition)
end
end
minetest.register_node("mcl_autocrafter:autocrafter", {
description = S("Autocrafter"),
tiles = {"pipeworks_autocrafter.png"},
stack_max = 64,
sounds = mcl_sounds.node_sound_wood_defaults(),
-- node group container: 4
-- -> take from dst, put to src; the same as furnace
groups = { dig_generic = 1, axey=5, container = 4 },
_mcl_hardness=1.6,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("src", 3*9)
inv:set_size("recipe", 3*3)
inv:set_size("dst", 4*3)
inv:set_size("output", 1)
meta:set_int("enabled", 0)
meta:set_string("infotext",mcl_autocrafter.get_infotext(nil,"UNCONFIGURED"))
meta:set_string("formspec",mcl_autocrafter.make_formspec("off"))
end,
on_receive_fields = function(pos, formname, fields, sender)
if fields.quit then return end
local name = sender:get_player_name() -- "" if not a player
if minetest.is_protected(pos, name) then
if name ~= "" then
minetest.record_protection_violation(pos, name)
end
return
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local output = inv:get_list("output")
if output then output = output[1] end
if output:is_empty() then output = nil end
if fields.on then
meta:set_int("enabled", 0)
meta:set_string("infotext",mcl_autocrafter.get_infotext(output,"UNCONFIGURED"))
meta:set_string("formspec",mcl_autocrafter.make_formspec("off"))
elseif fields.off then
meta:set_int("enabled",1)
meta:set_string("infotext",mcl_autocrafter.get_infotext(output,"OK"))
meta:set_string("formspec",mcl_autocrafter.make_formspec("on"))
local timer = minetest.get_node_timer(pos)
if not timer:is_started() then
timer:start(craft_time)
end
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) -- Modified from the one of furnaces
if not oldmetadata.inventory then return end
for _, listname in ipairs({"src", "dst"}) do
if oldmetadata.inventory[listname] then
for _,stack in ipairs(oldmetadata.inventory[listname]) do
if stack then
stack = ItemStack(stack) -- Ensure it is an ItemStack
if not stack:is_empty() then
-- from mcl_util
local drop_offset = vector.new(math.random() - 0.5, 0, math.random() - 0.5)
minetest.add_item(vector.add(pos, drop_offset), stack)
end
end
end
end
end
end,
on_destruct = function(pos)
local pos_hash = minetest.hash_node_position(pos)
crafting_cache[pos_hash] = nil
local timer = minetest.get_node_timer(pos)
if timer:is_started() then
timer:stop()
end
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local name = player:get_player_name() -- "" if not a player
if minetest.is_protected(pos, name) then
if name ~= "" then
minetest.record_protection_violation(pos, name)
end
return
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if listname == "recipe" then
stack:set_count(1)
minetest.log("action",string.format("[mcl_autocrafter] %s is put at index %d at %s",stack:to_string(),index,minetest.pos_to_string(pos)))
inv:set_stack(listname, index, stack)
mcl_autocrafter.after_recipe_change(pos, inv)
return 0
elseif listname == "output" then
-- I am lazy, so let's not to handle outputs
return 0
end
mcl_autocrafter.start_autocrafter(pos)
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local name = player:get_player_name() -- "" if not a player
if minetest.is_protected(pos, name) then
if name ~= "" then
minetest.record_protection_violation(pos, name)
end
return
end
local inv = minetest.get_meta(pos):get_inventory()
if listname == "recipe" then
inv:set_stack(listname, index, ItemStack(""))
mcl_autocrafter.after_recipe_change(pos, inv)
return 0
elseif listname == "output" then
-- I am lazy, so let's not to handle outputs
return 0
end
mcl_autocrafter.start_autocrafter(pos)
return stack:get_count()
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local name = player:get_player_name() -- "" if not a player
if minetest.is_protected(pos, name) then
if name ~= "" then
minetest.record_protection_violation(pos, name)
end
return
end
local inv = minetest.get_meta(pos):get_inventory()
local stack = inv:get_stack(from_list, from_index)
if to_list == "output" then
-- I am lazy, so let's not to handle outputs
return 0
elseif from_list == "output" then
if to_list ~= "recipe" then
return 0
end -- else fall through to recipe list handling
end
if from_list == "recipe" or to_list == "recipe" then
if from_list == "recipe" then
inv:set_stack(from_list, from_index, ItemStack(""))
end
if to_list == "recipe" then
stack:set_count(1)
inv:set_stack(to_list, to_index, stack)
end
mcl_autocrafter.after_recipe_change(pos, inv)
return 0
end
mcl_autocrafter.start_autocrafter(pos)
return count
end,
on_timer = function(pos, elapsed)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local craft = mcl_autocrafter.get_craft_for(pos, false)
if not craft then
meta:set_string("infotext",mcl_autocrafter.get_infotext(nil,"NO_VALID_CRAFT"))
end
-- Stop node timer if a fatal error occured.
-- mcl_util will restart the nodetimer just like a furnace.
local loops = math.floor(elapsed/craft_time)
local status, msg = mcl_autocrafter.do_autocraft_on(pos,loops,craft,false)
minetest.log("action",string.format("[mcl_autocrafter] Nodetimer on %s done, %s",minetest.pos_to_string(pos),(status and "success" or ("failed, " .. msg))))
if status then
---@diagnostic disable-next-line: need-check-nil
meta:set_string("infotext",mcl_autocrafter.get_infotext(craft.main_output,"OK"))
elseif msg == "NO_VALID_CRAFT" then
meta:set_string("infotext",mcl_autocrafter.get_infotext(nil,"NO_VALID_CRAFT"))
return false
elseif msg == "NOT_ENOUGH_SPACE" then
---@diagnostic disable-next-line: need-check-nil
meta:set_string("infotext",mcl_autocrafter.get_infotext(craft.main_output,"NOT_ENOUGH_SPACE"))
return false
end
return true
end
})
minetest.register_craft({
output = "mcl_autocrafter:autocrafter 2",
recipe = {
{ "mcl_core:iron_ingot", "mcl_core:diamond", "mcl_core:iron_ingot" },
{ "mcl_core:paper", "mcl_core:iron_ingot", "mcl_core:paper" },
{ "mcl_core:iron_ingot", "mcl_core:diamond", "mcl_core:iron_ingot" }
}
})

View File

@ -0,0 +1,8 @@
name = mcl_autocrafter
title = Autocrafters for MineClone2
description = Automate crafting process using hoppers and autocrafters
depends = mcl_core, mcl_formspec, mcl_util, mcl_sounds
supported_games = mineclone2
release = 19418
author = Emojiminetest

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -0,0 +1 @@
[?2004h[?1049h(B[?7h[?1h=[?1h=[?25l(B(B[ 新檔案 ](B(B GNU nano 7.2 LICENSE (B (B^G(B 說明(B^O(B 儲存(B^W(B 搜尋(B^K(B 剪下(B^T(B 執行(B^C(B 位置(BM-U(B 復原(BM-A(B 設定標記 (BM-](B 至 Bracket (BM-Q(B 上個(B^B(B 往回 (B^X(B 退出(B^R(B 讀取(B^\(B 取代(B^U(B 貼上(B^J(B 對齊(B^/(B 跳列(BM-E(B 重做(BM-6(B 複製(B^Q(B 搜尋(BM-W(B 下個(B^F(B 向前 [?12l[?25h[?25l(B[ 第 1/1 橫列 (100%),第 1/ 1 直行 (100%),第 0/0 個字元 ( 0%) ](B[?12l[?25h [?25l[?12l[?25h [?25l  (BM-C(B 區分大小寫  (BM-B(B 往回搜尋 (B^P(B 較舊(BC(B 取消  (BM-R(B 正規表示式  (B^R(B 不取代   (B^N(B 較新 (B搜尋 (替換): (B[?12l[?25h[?25l[?12l[?25h[?1049l [?1l>[?2004l

View File

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

41
mods/ADDONS/mcl_build_limit/.gitignore vendored Normal file
View File

@ -0,0 +1,41 @@
# Compiled Lua sources
luac.out
# luarocks build files
*.src.rock
*.zip
*.tar.gz
# Object files
*.o
*.os
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
*.def
*.exp
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

View File

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

View File

@ -0,0 +1,8 @@
# mcl_build_limit
[![ContentDB](https://content.minetest.net/packages/AFCM/mcl_build_limit/shields/title/)](https://content.minetest.net/packages/AFCM/mcl_build_limit/)
[![ContentDB](https://content.minetest.net/packages/AFCM/mcl_build_limit/shields/downloads/)](https://content.minetest.net/packages/AFCM/mcl_build_limit/)
Add a build limit to MineClone2

View File

@ -0,0 +1,41 @@
local c_void = minetest.get_content_id("mcl_core:void")
local limit_overworld = mcl_vars.mg_overworld_max_official+1
local limit_end = mcl_vars.mg_end_max_official+1
local function set_layers(data, area, content_id, check, min, max, minp, maxp, lvm_used, pr)
if (maxp.y >= min and minp.y <= max) then
for y = math.max(min, minp.y), math.min(max, maxp.y) do
for x = minp.x, maxp.x do
for z = minp.z, maxp.z do
local p_pos = area:index(x, y, z)
if check then
if type(check) == "function" and check({x=x,y=y,z=z}, data[p_pos], pr) then
data[p_pos] = content_id
lvm_used = true
elseif check == data[p_pos] then
data[p_pos] = content_id
lvm_used = true
end
else
data[p_pos] = content_id
lvm_used = true
end
end
end
end
end
return lvm_used
end
mcl_mapgen_core.register_generator("mcl_build_limit", function(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
local lvm_used = false
-- Void at the top of the Overworld
lvm_used = set_layers(data, area, c_void, nil, limit_overworld, limit_overworld, minp, maxp, lvm_used)
-- Void at the top of the End
lvm_used = set_layers(data, area, c_void, nil, limit_end, limit_end, minp, maxp, lvm_used)
return lvm_used
end, nil, 1, false)

View File

@ -0,0 +1,7 @@
name=mcl_build_limit
description=Add a build limit to MineClone2
depends=mcl_init, mcl_core, mcl_mapgen_core
release = 6737
author = AFCM
title = MineClone2 Build Limit

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 KiB

View File

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

View File

@ -0,0 +1,5 @@
This is a mod (created by Thisaccountis42) that adds 4 new music discs to the game: "minimal," "depado," "krank," and "phlips," all of which were produced by C418 and released under CC-By 3.0 licenses.
This mod requires Mineclone 2, more specifically mcl_jukebox, to run. It will likely also work with Mineclone 5, but this hasn't been tested.
See LICENSE.txt for credits/attributions, as well as the licenses the code and media are published under.

View File

@ -0,0 +1,10 @@
mcl_jukebox.register_record("minimal", "C418", "ward", "mcl_jukebox_record_ward.png", "mcl_jukebox_track_9")
mcl_jukebox.register_record("krank", "C418", "stal", "mcl_jukebox_record_stal.png", "mcl_jukebox_track_10")
mcl_jukebox.register_record("depado", "C418", "cat", "mcl_jukebox_record_cat.png", "mcl_jukebox_track_11")
mcl_jukebox.register_record("phlips", "C418", "11", "mcl_jukebox_record_11.png", "mcl_jukebox_track_12")
minetest.register_alias("mcl_jukebox:record_9", "mcl_jukebox:record_ward")
minetest.register_alias("mcl_jukebox:record_10", "mcl_jukebox:record_stal")
minetest.register_alias("mcl_jukebox:record_11", "mcl_jukebox:record_cat")
minetest.register_alias("mcl_jukebox:record_12", "mcl_jukebox:record_11")

View File

@ -0,0 +1,7 @@
name = mcl_jukebox_c418
description = Adds 4 new records: "minimal", "krank", "depado", and "phlips", all produced by C418 and released under CC-By 3.0 licenses
depends = mcl_jukebox
author = Thisaccountis42
release = 16485
title = Mineclone 2 C418 Records

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

View File

@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>

View File

@ -0,0 +1,18 @@
# Mineclone 2 (5) More Food mod [mcl_morefood]
This mod adds five more food items to the Mineclone 2 (5) game!
![Screenshot](/screenshot.png)
## Items
* ![texture](textures/mcl_morefood_sandwich.png) Sandwich
* ![texture](textures/mcl_morefood_chocolate_bar.png) Chocolate bar
* ![texture](textures/mcl_morefood_fried_egg.png) Fried egg
* ![texture](textures/mcl_morefood_cheese.png) Cheese
* ![texture](textures/mcl_morefood_sweet_berry_pie.png) Sweet Berry Pie
## Media sources
- Chocolate texture from Farming Redo by TenPlus1 (slighty edited by me)
- Cheese texture from Mobs Animal by Krupnov Pavel (slighty edited by me)
- Fried egg texture from Mobs Animal by Krupnov pavel (slighty edited by me)
- Sandwich texture uses bread texture from REFI by MysticTempest (slighty edited by me) and cooked beef palette from PixelPerfection by XSSheep
- Sweet Berry Pie texture uses pumpkin pie texture from PixelPerfection by XSSsheep

View File

@ -0,0 +1,109 @@
-- Mineclone 2 (5) MoreFood mod
-- by rudzik8
-- Licensed under Unlicense, more info here: <https://unlicense.org/>
local S = minetest.get_translator(minetest.get_current_modname())
local mofood_longdesc = S("This is a food item which can be eaten.")
minetest.register_craftitem("mcl_morefood:sandwich", {
description = S("Sandwich"),
_doc_items_longdesc = mofood_longdesc,
inventory_image = "mcl_morefood_sandwich.png",
groups = {food=2, eatable=14},
_mcl_saturation = 10.5,
on_place = minetest.item_eat(14),
on_secondary_use = minetest.item_eat(14),
})
minetest.register_craftitem("mcl_morefood:chocolate_bar", {
description = S("Chocolate Bar"),
_doc_items_longdesc = mofood_longdesc,
inventory_image = "mcl_morefood_chocolate_bar.png",
groups = {food=2, eatable=6},
_mcl_saturation = 4.0,
on_place = minetest.item_eat(6),
on_secondary_use = minetest.item_eat(6),
})
minetest.register_craftitem("mcl_morefood:fried_egg", {
description = S("Fried Egg"),
_doc_items_longdesc = mofood_longdesc,
inventory_image = "mcl_morefood_fried_egg.png",
groups = {food=2, eatable=8},
_mcl_saturation = 10.0,
on_place = minetest.item_eat(8),
on_secondary_use = minetest.item_eat(8),
})
minetest.register_craftitem("mcl_morefood:cheese", {
description = S("Cheese"),
_doc_items_longdesc = mofood_longdesc,
inventory_image = "mcl_morefood_cheese.png",
groups = {food=2, eatable=9},
_mcl_saturation = 8.6,
on_place = minetest.item_eat(9),
on_secondary_use = minetest.item_eat(9),
})
minetest.register_craftitem("mcl_morefood:sweet_berry_pie", {
description = S("Sweet Berry Pie"),
_doc_items_longdesc = S("A sweet berry pie is a tasty food item which can be eaten."),
inventory_image = "mcl_morefood_sweet_berry_pie.png",
groups = {food = 2, eatable = 6},
_mcl_saturation = 3.6,
on_place = minetest.item_eat(6),
on_secondary_use = minetest.item_eat(6),
})
-- Crafts
minetest.register_craft({
type = "shapeless",
output = "mcl_morefood:sandwich",
recipe = {"mcl_farming:bread", "mcl_mobitems:cooked_beef"},
})
minetest.register_craft({
type = "shapeless",
output = "mcl_morefood:sandwich",
recipe = {"mcl_farming:bread", "mcl_mobitems:cooked_mutton"},
})
minetest.register_craft({
type = "shapeless",
output = "mcl_morefood:sandwich",
recipe = {"mcl_farming:bread", "mcl_mobitems:cooked_chicken"},
})
minetest.register_craft({
type = "shapeless",
output = "mcl_morefood:sandwich",
recipe = {"mcl_farming:bread", "mcl_mobitems:cooked_porkchop"},
})
minetest.register_craft({
type = "shapeless",
output = "mcl_morefood:sandwich",
recipe = {"mcl_farming:bread", "mcl_mobitems:cooked_rabbit"},
})
minetest.register_craft({
output = "mcl_morefood:chocolate_bar",
recipe = {
{"mcl_dye:brown", "mcl_core:sugar", "mcl_dye:brown"},
{"mcl_dye:brown", "mcl_mobitems:milk_bucket", "mcl_dye:brown"},
},
replacements = {
{"mcl_mobitems:milk_bucket", "mcl_buckets:bucket_empty"},
},
})
minetest.register_craft({
type = "shapeless",
output = "mcl_morefood:sweet_berry_pie",
recipe = {"mcl_farming:sweet_berry", "mcl_core:sugar", "mcl_throwing:egg"},
})
minetest.register_craft({
type = "cooking",
output = "mcl_morefood:fried_egg",
recipe = "mcl_throwing:egg",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_morefood:cheese",
recipe = "mcl_mobitems:milk_bucket",
replacements = {
{"mcl_mobitems:milk_bucket", "mcl_buckets:bucket_empty"},
},
cooktime = 12,
})

View File

@ -0,0 +1,6 @@
# textdomain: mcl_morefood
Sandwich=Sandwich
Chocolate Bar=Barre de chocolat
Fried Egg=Œuf au plat
Cheese=Fromage
Sweet Berry Pie=Tarte aux baies sucrées

View File

@ -0,0 +1,6 @@
# textdomain: mcl_morefood
Sandwich=
Chocolate Bar=
Fried Egg=
Cheese=
Sweet Berry Pie=

View File

@ -0,0 +1,6 @@
name = mcl_morefood
author = rudzik8
depends = mcl_core, mcl_farming, mcl_buckets, mcl_dye, mcl_mobitems, mcl_throwing
description = This mod adds five more food items to the Mineclone 2 (5) game!
release = 18371
title = MineClone2 More Food

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

View File

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

View File

@ -0,0 +1,25 @@
# Rubber Addon for MineClone 2
by Biochemist
[![ContentDB](https://content.minetest.net/packages/biochemist/mcl_rubber/shields/downloads/)](https://content.minetest.net/packages/biochemist/mcl_rubber/)
## Features
- Adds a new Rubber Tree to the World, that you can find
- This tree can be cut down, and made into Planks, Stairs and Slabs
- some Stuff can be made from it too
- You can craft the treetap, a block, that can be attached to rubber trees to harvest their resource: rubber resin
- the rubber resin then can be put in the furnace, and made into different things
- one of these things are the rubber boots: they reduce the amount of fall damage you receive by 60%
- another use is making a rubber block out of it. This block acts like a trampoline and also negates fall damage completely
## Notes
- it is a mod designed to run with MineClone2, and extends it's gameplay
- if you want to make sure, that your mod is compatible with this one, you can just use *group:rubber* in your crafting recipes for one piece of rubber.
- it also uses an internal library, that will be split of eventually, but for now it's part of it; One less dependency to worry about for you.
## Usage
- you can download the zip file from here, and then just unpack it into your mods folder. In your mods folder now should be a folder called mcl-rubber (potentially rename it to mcl_rubber, because i don't know it it will just work)
- alternatively you can also just find it on ContentDB for Minetest
Have fun and enjoy!

View File

@ -0,0 +1,657 @@
-- This library will override itself, but might end up in its own dependency
-- for now every of my mods will just have a copy of it in there.
biolib = {}
-- Debugging functions ---------------------------------------------------------
function biolib.__dump_obj(o)
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. dump(v) .. ','
end
return s .. '} '
else
return tostring(o)
end
end
-- text is a string, that will be shown in global chat.
function biolib.debug(text)
minetest.chat_send_all(text)
end
-- text is a string that will be shown in global chat.
-- object is an Object that will be either destructured, or its type printed
function biolib.debug_object(text, obj)
local output = biolib.__dump_obj(obj)
biolib.debug(text..output)
end
-- Compat functions ------------------------------------------------------------
-- compat function for check growth with, and make it compatible to games, that don't expose it
if mcl_core ~= nil and mcl_core.check_growth_width ~= nil then
biolib.check_growth_width = mcl_core.check_growth_width
else
biolib.check_growth_width = function (pos, width, height)
-- Huge tree (with even width to check) will check one more node in
-- positive x and y directions.
local neg_space = math.min((width - 1) / 2)
local pos_space = math.max((width - 1) / 2)
for x = -neg_space, pos_space do
for z = -neg_space, pos_space do
for y = 1, height do
local np = vector.new(
pos.x + x,
pos.y + y,
pos.z + z)
if biolib.node_stops_growth(minetest.get_node(np)) then
return false
end
end
end
end
return true
end
biolib.node_stops_growth = function (node)
if node.name == "air" then
return false
end
local def = minetest.registered_nodes[node.name]
if not def then
return true
end
local groups = def.groups
if not groups then
return true
end
if groups.plant or groups.torch or groups.dirt or groups.tree
or groups.bark or groups.leaves or groups.wood then
return false
end
return true
end
end
-- Registry functions ----------------------------------------------------------
local S = minetest.get_translator(minetest.get_current_modname())
local on_rotate
if mod_screwdriver then
on_rotate = screwdriver.rotate_3way
end
-- nodename is the name of the node to register as tree trunk
-- description_trunk is the translated name of teh Trunk
-- description_bark is the translated name of the Bark
-- longdesc is the long description for the tree trunk
-- tile_inner is the texture for the cut part
-- tile_bark is the texture for the bark part
-- stripped_variant is the node name for the stripped variant
function biolib.register_tree_trunk(nodename, description_trunk, description_bark, longdesc, tile_inner, tile_bark, stripped_variant)
minetest.register_node(nodename, {
description = description_trunk,
_doc_items_longdesc = longdesc,
_doc_items_hidden = false,
tiles = {tile_inner, tile_inner, tile_bark},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {handy=1,axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(),
on_rotate = on_rotate,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = stripped_variant,
after_destruct = mcl_core.update_leaves,
})
minetest.register_node(nodename.."_bark", {
description = description_bark,
_doc_items_longdesc = S("This is a decorative block surrounded by the bark of a tree trunk."),
tiles = {tile_bark},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {handy=1,axey=1, bark=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(),
is_ground_content = false,
on_rotate = on_rotate,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = stripped_variant.."_bark",
})
minetest.register_craft({
output = nodename.."_bark 3",
recipe = {
{ nodename, nodename },
{ nodename, nodename },
}
})
end
-- nodename is the name of the node in question
-- description_stripped_trunk is the description of the stripped trunk variant
-- description_stripped_bark is the description of the stripped bark variant
-- longdesc is the long description for the stripped trunk
-- longdesc_wood is the long description for the stripped bark
-- tile_stripped_inner is the cut texture for the stripped wood
-- tile_stripped_bark is the side texture for the stripped wood
function biolib.register_stripped_trunk(nodename, description_stripped_trunk, description_stripped_bark, longdesc, longdesc_wood, tile_stripped_inner, tile_stripped_bark)
minetest.register_node(nodename, {
description = description_stripped_trunk,
_doc_items_longdesc = longdesc,
_doc_items_hidden = false,
tiles = {tile_stripped_inner, tile_stripped_inner, tile_stripped_bark},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {handy=1, axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(),
on_rotate = on_rotate,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
})
minetest.register_node(nodename.."_bark", {
description = description_stripped_bark,
_doc_items_longdesc = longdesc_wood,
tiles = {tile_stripped_bark},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {handy=1, axey=1, bark=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(),
is_ground_content = false,
on_rotate = on_rotate,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
})
minetest.register_craft({
output = nodename.."_bark 3",
recipe = {
{ nodename, nodename },
{ nodename, nodename },
}
})
end
-- nodename is the name of the node in question
-- description is the description of the planks
-- tiles is the texture for the planks
function biolib.register_planks(nodename, description, tiles)
minetest.register_node(nodename, {
description = description,
_doc_items_longdesc = doc.sub.items.temp.build,
_doc_items_hidden = false,
tiles = tiles,
stack_max = 64,
is_ground_content = false,
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=20},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 3,
_mcl_hardness = 2,
})
end
-- name is the name of the node without the mod identifier
-- nodename is the name of the node in question (with mod)
-- texture is the texture, that shall be used for the stairs and slabs
-- stairs_name is the translated name for the stairs
-- slabs_name is the translated name for the single slab
-- dbl_slabs_name is the translated name for double slabs
function biolib.register_wooden_stairs(name, nodename, texture, stairs_name, slabs_name, dbl_slabs_name)
mcl_stairs.register_stair(name, nodename,
{handy=1,axey=1, flammable=3,wood_stairs=1, material_wood=1, fire_encouragement=5, fire_flammability=20},
{texture},
stairs_name,
mcl_sounds.node_sound_wood_defaults(), 3, 2,
"woodlike")
mcl_stairs.register_slab(name, nodename,
{handy=1,axey=1, flammable=3,wood_slab=1, material_wood=1, fire_encouragement=5, fire_flammability=20},
{texture},
slabs_name,
mcl_sounds.node_sound_wood_defaults(), 3, 2,
dbl_slabs_name)
end
-- name is the name of the node without the mod identifier
-- nodename is the name of the node in question (with mod); will be used for crafting too
-- fence_name is the translated name of the fence
-- fence_gate_name is the translated name of the fence gate
-- fence_tex is the texture used for fence and gates
-- craft_item is the wood item to craft the fences and gate swith
function biolib.register_wooden_fence(name, nodename, fence_name, fence_gate_name, fence_tex)
local wood_groups = {handy=1,axey=1, flammable=2,fence_wood=1, fire_encouragement=5, fire_flammability=20}
local wood_connect = {"group:fence_wood"}
local wood_sounds = mcl_sounds.node_sound_wood_defaults()
local id = name.."_fence"
local mod_id = nodename.."_fence"
local mod_id_gate = nodename.."_fence_gate"
mcl_fences.register_fence_and_fence_gate(id, fence_name, fence_gate_name, fence_tex, wood_groups, 2, 15, wood_connect, wood_sounds)
minetest.register_craft({
output = mod_id.." 3",
recipe = {
{nodename, "mcl_core:stick", nodename},
{nodename, "mcl_core:stick", nodename},
}
})
minetest.register_craft({
output = mod_id_gate,
recipe = {
{"mcl_core:stick", nodename, "mcl_core:stick"},
{"mcl_core:stick", nodename, "mcl_core:stick"},
}
})
end
-- nodename is the name of the node in question (with mod)
-- description is the description of the sapling
-- longdesc is the long description for the sapling
-- tt_help is the tooltip for the sapling
-- texture is the texture used for the sapling
-- selbox defines the selection box for the sapling
function biolib.register_sapling(nodename, description, longdesc, tt_help, texture, selbox)
minetest.register_node(nodename, {
description = description,
_tt_help = tt_help,
_doc_items_longdesc = longdesc,
_doc_items_hidden = false,
drawtype = "plantlike",
waving = 1,
visual_scale = 1.0,
tiles = {texture},
inventory_image = texture,
wield_image = texture,
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = selbox
},
stack_max = 64,
groups = {
plant = 1, sapling = 1, non_mycelium_plant = 1, attached_node = 1,
deco_block = 1, dig_immediate = 3, dig_by_water = 1, dig_by_piston = 1,
destroy_by_lava_flow = 1, compostability = 30
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_int("stage", 0)
end,
on_place = mcl_util.generate_on_place_plant_function(function(pos, node)
local node_below = minetest.get_node_or_nil({x=pos.x,y=pos.y-1,z=pos.z})
if not node_below then return false end
local nn = node_below.name
return minetest.get_item_group(nn, "grass_block") == 1 or
nn == "mcl_core:podzol" or nn == "mcl_core:podzol_snow" or
nn == "mcl_core:dirt" or nn == "mcl_core:mycelium" or nn == "mcl_core:coarse_dirt"
end),
node_placement_prediction = "",
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
})
end
-- nodename is the name of the node in question (with mod)
-- description is the description of the leaves
-- longdesc is the long description for the leaves
-- tiles is the texture used for the leaves
-- sapling is the name of the sapling, that is being dropped
-- sapling_chances are the chances of the sapling being dropped for a specific fortune level
-- additional_drop is an additional drop {name, drop_chances}. If none given, drops sticks
function biolib.register_leaves(nodename, description, longdesc, tiles, sapling, sapling_chances, additional_drop)
local stick_chances = {50, 45, 30, 35, 10}
if additional_drop == nil then
additional_drop = {"mcl_core:stick 2", stick_chances}
end
local function get_drops(fortune_level)
local drop = {
max_items = 1,
items = {
{
items = {sapling},
rarity = sapling_chances[fortune_level + 1] or sapling_chances[fortune_level]
},
{
items = {"mcl_core:stick 1"},
rarity = stick_chances[fortune_level + 1]
},
{
items = {additional_drop[1]},
rarity = additional_drop[2][fortune_level + 1]
},
}
}
return drop
end
local leaves_def = {
description = description,
_doc_items_longdesc = longdesc,
_doc_items_hidden = false,
drawtype = "allfaces_optional",
waving = 2,
place_param2 = 1, -- Prevent leafdecay for placed nodes
tiles = tiles,
paramtype = "light",
stack_max = 64,
groups = {
handy = 1, hoey = 1, shearsy = 1, swordy = 1, dig_by_piston = 1,
leaves = 1, deco_block = 1,
flammable = 2, fire_encouragement = 30, fire_flammability = 60,
compostability = 30
},
drop = get_drops(0),
_mcl_shears_drop = true,
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0.2,
_mcl_hardness = 0.2,
_mcl_silk_touch_drop = true,
_mcl_fortune_drop = { get_drops(1), get_drops(2), get_drops(3), get_drops(4) },
}
local leaves_orphan_def = table.copy(leaves_def)
leaves_orphan_def._doc_items_create_entry = false
leaves_orphan_def.place_param2 = nil
leaves_orphan_def.groups.not_in_creative_inventory = 1
leaves_orphan_def.groups.orphan_leaves = 1
leaves_orphan_def._mcl_shears_drop = {nodename}
leaves_orphan_def._mcl_silk_touch_drop = {nodename}
minetest.register_node(nodename, leaves_def)
minetest.register_node(nodename.."_orphan", leaves_orphan_def)
end
-- Custom Sapling related Functions --------------------------------------------
biolib.__custom_saplings = {}
biolib.__orig_grow_sapling = mcl_core.grow_sapling
function biolib.__grow_sapling(pos, node)
local grow_function = biolib.__custom_saplings[node.name]
if grow_function then
if grow_function(pos) then
return true
else
return false
end
end
return biolib.__orig_grow_sapling(pos, node)
end
-- override original grow sampling method with augmented one
mcl_core.grow_sapling = biolib.__grow_sapling
-- name is the name of the sapling in question
-- the grow function is the function, that is for actually growing the sapling
function biolib.register_bonemeal_sapling(name, grow_func)
biolib.__custom_saplings[name] = grow_func
end
-- Custom Treetap related Functions --------------------------------------------
-- Check if placement at given node is allowed
function biolib._check_placement_allowed(node, wdir)
-- Torch placement rules: Disallow placement on some nodes. General rule: Solid, opaque, full cube collision box nodes are allowed.
-- Special allowed nodes:
-- * soul sand
-- * mob spawner
-- * chorus flower
-- * glass, barrier, ice
-- * Fence, wall, end portal frame with ender eye: Only on top
-- * Slab, stairs: Only on top if upside down
-- Special forbidden nodes:
-- * Piston, sticky piston
local def = minetest.registered_nodes[node.name]
if not def then
return false
-- No ceiling torches
elseif wdir == 0 then
return false
elseif not def.buildable_to then
if node.name ~= "mcl_core:ice" and node.name ~= "mcl_nether:soul_sand" and node.name ~= "mcl_mobspawners:spawner" and node.name ~= "mcl_core:barrier" and node.name ~= "mcl_end:chorus_flower" and node.name ~= "mcl_end:chorus_flower_dead" and (not def.groups.glass) and
((not def.groups.solid) or (not def.groups.opaque)) then
-- Only allow top placement on these nodes
if node.name == "mcl_end:dragon_egg" or node.name == "mcl_portals:end_portal_frame_eye" or def.groups.fence == 1 or def.groups.wall or def.groups.slab_top == 1 or def.groups.anvil or def.groups.pane or (def.groups.stair == 1 and minetest.facedir_to_dir(node.param2).y ~= 0) then
if wdir ~= 1 then
return false
end
else
return false
end
elseif minetest.get_item_group(node.name, "piston") >= 1 then
return false
end
end
return true
end
-- nodename is the name of the node (and their variants)
-- description is the translated name of the node
-- help is the tooltip text of the node
-- long_desc is the long description for this node
-- usage is the usage text for this node
-- resource_name will be used to generate all the resource paths
-- attach_name is the name of the node it can attach to.
-- final_drop is the drop that you get, when the treetap is filled
-- fill_level is the incremental value of what the fill level is.
function biolib.register_treetap_variant(nodename, description, help, long_desc, usage, resource_name, attach_name, final_drop, fill_level)
local indexed_nodename = nodename
local indexed_resource_name = resource_name
if fill_level > 0 then
indexed_nodename = nodename.."_"..fill_level
indexed_resource_name = resource_name.."_"..fill_level
end
local groups = {}
local config = {}
-- general data
config.stack_max = 64
if fill_level > 0 then
config._doc_items_create_entry = false
config._doc_items_hidden = true
else
config.description = description
config._tt_help = help
config._doc_items_longdesc = long_desc
config._doc_items_usagehelp = usage
end
-- graphics related date
config.drawtype = "mesh"
config.mesh = indexed_resource_name..".obj"
config.tiles = {resource_name..".png"}
config.use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true
config.inventory_image = resource_name.."_inv.png"
config.wield_image = resource_name.."_inv.png"
config.wield_scale = {x=1.0, y=1.0, z=1.0}
config.selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
}
-- node related data
config._mcl_blast_resistance = 1.3
config._mcl_hardness = 0.7
groups.handy = 1
groups.axey = 1
groups.flammable = 3
groups.fire_encouragement = 5
groups.fire_flammability = 20
config.collision_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
}
-- sound related stuff
config.sounds = mcl_sounds.node_sound_wood_defaults()
-- placement related config
config.node_placement_prediction = ""
config.liquids_pointable = false
if fill_level == 0 then
config.on_place = function(itemstack, placer, pointed_at)
-- there is nothing pointed at
if pointed_at.type ~= "node" then
return itemstack
end
local under = pointed_at.under
local node = minetest.get_node(under)
local def = minetest.registered_nodes[node.name]
if not def then return itemstack end
-- there is something pointed at, but it's this specific node
if node.name ~= attach_name then
return itemstack
end
-- Call on_rightclick if the pointed node defines it
if placer and not placer:get_player_control().sneak then
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
return minetest.registered_nodes[node.name].on_rightclick(under, node, placer, itemstack) or itemstack
end
end
local above = pointed_at.above
local wdir = minetest.dir_to_wallmounted({x = under.x - above.x, y = under.y - above.y, z = under.z - above.z})
if biolib._check_placement_allowed(node, wdir) == false then
return itemstack
end
if wdir == 1 or wdir == 0 then
return itemstack
end
local success
itemstack, success = minetest.item_place(itemstack, placer, pointed_at, wdir)
if success and config.sounds and config.sounds.place then
minetest.sound_play(config.sounds.place, {pos=under, gain=1}, true)
end
return itemstack
end
end
if fill_level == 4 then
config.on_rightclick = function(pos, node, player, itemstack)
if not player:get_player_control().sneak then
local new_stack = ItemStack(final_drop)
local random_pos = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
local new_node = {name = nodename, param1 = node.param1, param2 = node.param2}
minetest.add_item(pos, new_stack)
minetest.swap_node(pos, new_node)
end
return itemstack
end
end
-- misc config stuff
config.on_rotate = false
config.paramtype = "light"
config.paramtype2 = "wallmounted"
config.sunlight_propagates = true
config.is_ground_content = false
config.drop = nodename
-- other group related stuff
groups.attached_node = 1
groups.dig_by_water = 1
groups.destroy_by_lava_flow = 1
groups.dig_by_piston = 1
groups.resin_fill = fill_level
groups.treetap = 1
config.groups = groups
minetest.register_node(indexed_nodename, config)
end
-- nodenames is the list of node names that are triggered by the world
-- depends_on is a variable that restricts the updates to nodes with specific neighbors. nil will ignore the setting.
-- abm_label is the label for the register_abm function
-- lbm_label is the label for the register_lbm function
-- lbm_name is the unique name for the register_lbm function
-- interval is the updating interval
-- chance is the chance of it being triggered
-- update_func is the actual function to update in the world
function biolib.register_world_updates(nodenames, depends_on, abm_label, lbm_label, lbm_name, interval, chance, update_func)
local config_abm = {}
local config_lbm = {}
config_abm.label = abm_label
config_lbm.label = lbm_label
config_abm.nodenames = nodenames
config_abm.nodenames = nodenames
config_lbm.name = lbm_name
if depends_on then
config_abm.neighbors = depends_on
end
config_abm.interval = interval
config_abm.chance = chance
config_abm.action = update_func
config_lbm.action = update_func
config_lbm.run_at_every_load = true
minetest.register_abm(config_abm)
minetest.register_lbm(config_lbm)
end
-- Custom effects/events related functions -------------------------------------
-- use this with minetest.register_on_player_hpchange
-- this function enables footgear to be in the fall_damage_add_percent group
function biolib.do_modify_falldamage_with_boots(player, hp_change, mt_reason)
if hp_change < 0 and mt_reason["type"] == "fall" and player and player:is_player() then
local playername = player:get_player_name()
local inventory = mcl_util.get_inventory(player, true)
local boots = inventory:get_stack("armor", mcl_armor.elements.feet.index)
local fall_damage = minetest.get_item_group(boots:get_name(), "fall_damage_add_percent")
if not fall_damage == 0 then
local hp_change_mod = fall_damage * hp_change / 100
local hp_diff = hp_change + hp_change_mod
local hp_remainder = hp_change - hp_diff
mcl_util.use_item_durability(boots, math.abs(hp_remainder))
inventory:set_stack("armor", mcl_armor.elements.feet.index, boots)
return hp_diff
end
end
return hp_change
end

View File

@ -0,0 +1,132 @@
local modpath = minetest.get_modpath(minetest.get_current_modname())
function mcl_rubber.generate_rubber_tree(pos)
local t = math.random(1, 3)
local path = modpath .. "/schematics/mcl_rubber_tree_"..t..".mts"
local offset
if t == 1 or t == 3 then
offset = { x = -1, y = -1, z = -1 }
elseif t == 2 then
offset = { x = -2, y = -1, z = -2 }
end
minetest.place_schematic(vector.add(pos, offset), path, "random", nil, false)
end
function mcl_rubber.rubber_sapling_grow_action(soil_needed, sapling, treelight)
return function(pos)
local meta = minetest.get_meta(pos)
if meta:get("grown") then return end
-- Checks if the sapling at pos has enough light and the correct soil
local light = minetest.get_node_light(pos)
if not light then return end
local low_light = (light < treelight)
local delta = 1
local current_game_time = minetest.get_day_count() + minetest.get_timeofday()
local last_game_time = tonumber(meta:get_string("last_gametime"))
meta:set_string("last_gametime", tostring(current_game_time))
if last_game_time then
delta = current_game_time - last_game_time
elseif low_light then
return
end
if low_light then
if delta < 1.2 then return end
if minetest.get_node_light(pos, 0.5) < treelight then return end
end
local soilnode = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
local soiltype = minetest.get_item_group(soilnode.name, "soil_sapling")
if soiltype < soil_needed then return end
-- Increase and check growth stage
local meta = minetest.get_meta(pos)
local stage = meta:get_int("stage")
if stage == nil then stage = 0 end
stage = stage + math.max(1, math.floor(delta))
if stage >= 3 then
meta:set_string("grown", "true")
-- If this sapling can grow alone
if biolib.check_growth_width(pos, 5, 11) then
-- Single sapling
minetest.set_node(pos, {name="air"})
mcl_rubber.generate_rubber_tree(pos)
return
end
else
meta:set_int("stage", stage)
end
end
end
function mcl_rubber.treetap_update_action(nodename)
return function(pos)
local node = minetest.get_node({x=pos.x, y=pos.y, z=pos.z})
local back_offset = minetest.wallmounted_to_dir(node.param2)
local right_offset = {x=-back_offset.z, y=back_offset.y, z=back_offset.x}
local neighbors = 0
-- opposite side
local neighbor_pos = {
x=pos.x+(2*back_offset.x),
y=pos.y+(2*back_offset.y),
z=pos.z+(2*back_offset.z)}
local neighbor_node = minetest.get_node(neighbor_pos)
local neighbor_group = minetest.get_item_group(neighbor_node.name, "treetap")
if neighbor_group > 0 then neighbors = neighbors + 1 end
-- right diagonal
neighbor_pos = {
x=pos.x+(1*back_offset.x)+(1*right_offset.x),
y=pos.y+(1*back_offset.y)+(1*right_offset.y),
z=pos.z+(1*back_offset.z)+(1*right_offset.z)}
neighbor_node = minetest.get_node(neighbor_pos)
neighbor_group = minetest.get_item_group(neighbor_node.name, "treetap")
if neighbor_group > 0 then neighbors = neighbors + 1 end
-- left diagonal
neighbor_pos = {
x=pos.x+(1*back_offset.x)-(1*right_offset.x),
y=pos.y+(1*back_offset.y)-(1*right_offset.y),
z=pos.z+(1*back_offset.z)-(1*right_offset.z)}
neighbor_node = minetest.get_node(neighbor_pos)
neighbor_group = minetest.get_item_group(neighbor_node.name, "treetap")
if neighbor_group > 0 then neighbors = neighbors + 1 end
-- above
neighbor_pos = {
x=pos.x,
y=pos.y+1,
z=pos.z}
neighbor_node = minetest.get_node(neighbor_pos)
neighbor_group = minetest.get_item_group(neighbor_node.name, "treetap")
if neighbor_group > 0 then neighbors = neighbors + 1 end
-- below
neighbor_pos = {
x=pos.x,
y=pos.y-1,
z=pos.z}
neighbor_node = minetest.get_node(neighbor_pos)
neighbor_group = minetest.get_item_group(neighbor_node.name, "treetap")
if neighbor_group > 0 then neighbors = neighbors + 1 end
local success = math.random(neighbors+1)
if success == 1 then
node_group = minetest.get_item_group(node.name, "resin_fill") + 1
minetest.swap_node(pos, {name=nodename.."_"..node_group, param1=node.param1, param2=node.param2})
end
end
end

View File

@ -0,0 +1,8 @@
local modpath = minetest.get_modpath(minetest.get_current_modname())
mcl_rubber = {}
dofile(modpath.."/biolib.lua")
dofile(modpath.."/functions.lua")
dofile(modpath.."/register.lua")

View File

@ -0,0 +1,7 @@
name = mcl_rubber
title = Rubber Addon for MineClone
author = biochemist
depends = mcl_core, mcl_sounds, mcl_stairs, mcl_fences, mcl_util
description = Adds rubber and related Items to MineClone 2.
optional_depends = doc, screwdriver
release = 17864

View File

@ -0,0 +1,100 @@
# Blender v3.0.0 Beta OBJ File: ''
# www.blender.org
mtllib mcl_rubber_treetap.mtl
o treetap_0_Cube.004
v 0.187500 -0.500000 -0.250000
v 0.125000 -0.437500 0.187500
v -0.187500 -0.500000 -0.250000
v -0.125000 -0.437500 0.187500
v 0.187500 -0.125000 -0.250000
v 0.125000 -0.187500 0.187500
v -0.187500 -0.125000 -0.250000
v -0.125000 -0.187500 0.187500
v 0.187500 -0.500000 0.187500
v -0.187500 -0.500000 0.187500
v -0.187500 -0.125000 0.187500
v 0.187500 -0.125000 0.187500
v 0.125000 -0.437500 -0.187500
v -0.125000 -0.437500 -0.187500
v -0.125000 -0.187500 -0.187500
v 0.125000 -0.187500 -0.187500
v 0.062500 -0.312500 0.250000
v -0.062500 -0.312500 0.250000
v 0.062500 -0.625000 0.250000
v -0.062500 -0.625000 0.250000
v 0.062500 -0.312500 0.187500
v -0.062500 -0.312500 0.187500
vt 0.750000 0.500000
vt 0.750000 0.937500
vt 0.375000 0.937500
vt 0.375000 0.500000
vt 0.000000 0.937500
vt 0.000000 0.500000
vt 1.000000 0.500000
vt 1.000000 0.937500
vt 0.625000 0.937500
vt 0.625000 0.500000
vt 0.687500 0.500000
vt 0.687500 0.937500
vt 0.312500 0.937500
vt 0.312500 0.500000
vt 0.000000 1.000000
vt 0.000000 0.625000
vt 0.375000 0.625000
vt 0.375000 1.000000
vt 0.500000 0.937500
vt 0.250000 0.937500
vt 0.250000 0.500000
vt 0.500000 0.500000
vt 0.937500 0.312500
vt 0.937500 0.062500
vt 1.000000 0.000000
vt 1.000000 0.375000
vt 0.687500 0.062500
vt 0.625000 0.000000
vt 0.687500 0.312500
vt 0.625000 0.375000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt 0.750000 1.000000
vt 0.750000 0.750000
vt 0.750000 0.937500
vt 0.500000 0.937500
vt 0.500000 0.500000
vt 0.750000 0.500000
vt 1.000000 0.937500
vt 0.750000 0.937500
vt 0.750000 0.500000
vt 1.000000 0.500000
vt 0.000000 0.937500
vt 0.000000 0.500000
vt 0.312500 0.375000
vt 0.312500 0.500000
vt 0.000000 0.500000
vt 0.000000 0.375000
vt 0.375000 0.375000
vt 0.375000 0.500000
vn 0.0000 -1.0000 0.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 1.0000 0.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 0.0000 -1.0000
vn 0.0000 0.0000 1.0000
usemtl Material.002
s off
f 1/1/1 9/2/1 10/3/1 3/4/1
f 3/4/2 10/3/2 11/5/2 7/6/2
f 7/7/3 11/8/3 12/9/3 5/10/3
f 5/11/4 12/12/4 9/13/4 1/14/4
f 3/15/5 7/16/5 5/17/5 1/18/5
f 6/19/1 8/20/1 15/21/1 16/22/1
f 2/23/6 4/24/6 10/25/6 9/26/6
f 4/24/6 8/27/6 11/28/6 10/25/6
f 8/27/6 6/29/6 12/30/6 11/28/6
f 6/29/6 2/23/6 9/26/6 12/30/6
f 15/31/6 14/32/6 13/33/6 16/34/6
f 4/35/3 2/36/3 13/37/3 14/38/3
f 2/39/2 6/40/2 16/41/2 13/42/2
f 8/20/4 4/43/4 14/44/4 15/21/4
f 18/45/5 17/46/5 19/47/5 20/48/5
f 17/46/1 18/45/1 22/49/1 21/50/1

View File

@ -0,0 +1,100 @@
# Blender v3.0.0 Beta OBJ File: ''
# www.blender.org
mtllib mcl_rubber_treetap_1.mtl
o treetap_1_Cube.005
v 0.187500 -0.500000 -0.250000
v 0.125000 -0.437500 0.187500
v -0.187500 -0.500000 -0.250000
v -0.125000 -0.437500 0.187500
v 0.187500 -0.125000 -0.250000
v 0.125000 -0.187500 0.187500
v -0.187500 -0.125000 -0.250000
v -0.125000 -0.187500 0.187500
v 0.187500 -0.500000 0.187500
v -0.187500 -0.500000 0.187500
v -0.187500 -0.125000 0.187500
v 0.187500 -0.125000 0.187500
v 0.125000 -0.437500 -0.187500
v -0.125000 -0.437500 -0.187500
v -0.125000 -0.187500 -0.187500
v 0.125000 -0.187500 -0.187500
v 0.062500 -0.312500 0.250000
v -0.062500 -0.312500 0.250000
v 0.062500 -0.625000 0.250000
v -0.062500 -0.625000 0.250000
v 0.062500 -0.312500 0.187500
v -0.062500 -0.312500 0.187500
vt 0.750000 0.500000
vt 0.750000 0.937500
vt 0.375000 0.937500
vt 0.375000 0.500000
vt 0.000000 0.937500
vt 0.000000 0.500000
vt 1.000000 0.500000
vt 1.000000 0.937500
vt 0.625000 0.937500
vt 0.625000 0.500000
vt 0.687500 0.500000
vt 0.687500 0.937500
vt 0.312500 0.937500
vt 0.312500 0.500000
vt 0.000000 1.000000
vt 0.000000 0.625000
vt 0.375000 0.625000
vt 0.375000 1.000000
vt 0.500000 0.937500
vt 0.250000 0.937500
vt 0.250000 0.500000
vt 0.500000 0.500000
vt 0.937500 0.312500
vt 0.937500 0.062500
vt 1.000000 0.000000
vt 1.000000 0.375000
vt 0.687500 0.062500
vt 0.625000 0.000000
vt 0.687500 0.312500
vt 0.625000 0.375000
vt 0.250000 0.000000
vt 0.250000 0.250000
vt 0.000000 0.250000
vt 0.000000 0.000000
vt 0.750000 0.937500
vt 0.500000 0.937500
vt 0.500000 0.500000
vt 0.750000 0.500000
vt 1.000000 0.937500
vt 0.750000 0.937500
vt 0.750000 0.500000
vt 1.000000 0.500000
vt 0.000000 0.937500
vt 0.000000 0.500000
vt 0.312500 0.375000
vt 0.312500 0.500000
vt 0.000000 0.500000
vt 0.000000 0.375000
vt 0.375000 0.375000
vt 0.375000 0.500000
vn 0.0000 -1.0000 0.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 1.0000 0.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 0.0000 -1.0000
vn 0.0000 0.0000 1.0000
usemtl Material.002
s off
f 1/1/1 9/2/1 10/3/1 3/4/1
f 3/4/2 10/3/2 11/5/2 7/6/2
f 7/7/3 11/8/3 12/9/3 5/10/3
f 5/11/4 12/12/4 9/13/4 1/14/4
f 3/15/5 7/16/5 5/17/5 1/18/5
f 6/19/1 8/20/1 15/21/1 16/22/1
f 2/23/6 4/24/6 10/25/6 9/26/6
f 4/24/6 8/27/6 11/28/6 10/25/6
f 8/27/6 6/29/6 12/30/6 11/28/6
f 6/29/6 2/23/6 9/26/6 12/30/6
f 15/31/6 14/32/6 13/33/6 16/34/6
f 4/35/3 2/36/3 13/37/3 14/38/3
f 2/39/2 6/40/2 16/41/2 13/42/2
f 8/20/4 4/43/4 14/44/4 15/21/4
f 18/45/5 17/46/5 19/47/5 20/48/5
f 17/46/1 18/45/1 22/49/1 21/50/1

View File

@ -0,0 +1,100 @@
# Blender v3.0.0 Beta OBJ File: ''
# www.blender.org
mtllib mcl_rubber_treetap_2.mtl
o treetap_2_Cube.006
v 0.187500 -0.500000 -0.250000
v 0.125000 -0.437500 0.187500
v -0.187500 -0.500000 -0.250000
v -0.125000 -0.437500 0.187500
v 0.187500 -0.125000 -0.250000
v 0.125000 -0.187500 0.187500
v -0.187500 -0.125000 -0.250000
v -0.125000 -0.187500 0.187500
v 0.187500 -0.500000 0.187500
v -0.187500 -0.500000 0.187500
v -0.187500 -0.125000 0.187500
v 0.187500 -0.125000 0.187500
v 0.125000 -0.437500 -0.062500
v -0.125000 -0.437500 -0.062500
v -0.125000 -0.187500 -0.062500
v 0.125000 -0.187500 -0.062500
v 0.062500 -0.312500 0.250000
v -0.062500 -0.312500 0.250000
v 0.062500 -0.625000 0.250000
v -0.062500 -0.625000 0.250000
v 0.062500 -0.312500 0.187500
v -0.062500 -0.312500 0.187500
vt 0.750000 0.500000
vt 0.750000 0.937500
vt 0.375000 0.937500
vt 0.375000 0.500000
vt 0.000000 0.937500
vt 0.000000 0.500000
vt 1.000000 0.500000
vt 1.000000 0.937500
vt 0.625000 0.937500
vt 0.625000 0.500000
vt 0.687500 0.500000
vt 0.687500 0.937500
vt 0.312500 0.937500
vt 0.312500 0.500000
vt 0.000000 1.000000
vt 0.000000 0.625000
vt 0.375000 0.625000
vt 0.375000 1.000000
vt 0.500000 0.937500
vt 0.250000 0.937500
vt 0.250000 0.625000
vt 0.500000 0.625000
vt 0.937500 0.312500
vt 0.937500 0.062500
vt 1.000000 0.000000
vt 1.000000 0.375000
vt 0.687500 0.062500
vt 0.625000 0.000000
vt 0.687500 0.312500
vt 0.625000 0.375000
vt 0.250000 0.000000
vt 0.250000 0.250000
vt 0.000000 0.250000
vt 0.000000 0.000000
vt 0.750000 0.937500
vt 0.500000 0.937500
vt 0.500000 0.625000
vt 0.750000 0.625000
vt 1.000000 0.937500
vt 0.750000 0.937500
vt 0.750000 0.625000
vt 1.000000 0.625000
vt 0.000000 0.937500
vt 0.000000 0.625000
vt 0.312500 0.375000
vt 0.312500 0.500000
vt 0.000000 0.500000
vt 0.000000 0.375000
vt 0.375000 0.375000
vt 0.375000 0.500000
vn 0.0000 -1.0000 0.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 1.0000 0.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 0.0000 -1.0000
vn 0.0000 0.0000 1.0000
usemtl Material.002
s off
f 1/1/1 9/2/1 10/3/1 3/4/1
f 3/4/2 10/3/2 11/5/2 7/6/2
f 7/7/3 11/8/3 12/9/3 5/10/3
f 5/11/4 12/12/4 9/13/4 1/14/4
f 3/15/5 7/16/5 5/17/5 1/18/5
f 6/19/1 8/20/1 15/21/1 16/22/1
f 2/23/6 4/24/6 10/25/6 9/26/6
f 4/24/6 8/27/6 11/28/6 10/25/6
f 8/27/6 6/29/6 12/30/6 11/28/6
f 6/29/6 2/23/6 9/26/6 12/30/6
f 15/31/6 14/32/6 13/33/6 16/34/6
f 4/35/3 2/36/3 13/37/3 14/38/3
f 2/39/2 6/40/2 16/41/2 13/42/2
f 8/20/4 4/43/4 14/44/4 15/21/4
f 18/45/5 17/46/5 19/47/5 20/48/5
f 17/46/1 18/45/1 22/49/1 21/50/1

View File

@ -0,0 +1,100 @@
# Blender v3.0.0 Beta OBJ File: ''
# www.blender.org
mtllib mcl_rubber_treetap_3.mtl
o treetap_3_Cube.007
v 0.187500 -0.500000 -0.250000
v 0.125000 -0.437500 0.187500
v -0.187500 -0.500000 -0.250000
v -0.125000 -0.437500 0.187500
v 0.187500 -0.125000 -0.250000
v 0.125000 -0.187500 0.187500
v -0.187500 -0.125000 -0.250000
v -0.125000 -0.187500 0.187500
v 0.187500 -0.500000 0.187500
v -0.187500 -0.500000 0.187500
v -0.187500 -0.125000 0.187500
v 0.187500 -0.125000 0.187500
v 0.125000 -0.437500 0.000000
v -0.125000 -0.437500 0.000000
v -0.125000 -0.187500 0.000000
v 0.125000 -0.187500 0.000000
v 0.062500 -0.312500 0.250000
v -0.062500 -0.312500 0.250000
v 0.062500 -0.625000 0.250000
v -0.062500 -0.625000 0.250000
v 0.062500 -0.312500 0.187500
v -0.062500 -0.312500 0.187500
vt 0.750000 0.500000
vt 0.750000 0.937500
vt 0.375000 0.937500
vt 0.375000 0.500000
vt 0.000000 0.937500
vt 0.000000 0.500000
vt 1.000000 0.500000
vt 1.000000 0.937500
vt 0.625000 0.937500
vt 0.625000 0.500000
vt 0.687500 0.500000
vt 0.687500 0.937500
vt 0.312500 0.937500
vt 0.312500 0.500000
vt 0.000000 1.000000
vt 0.000000 0.625000
vt 0.375000 0.625000
vt 0.375000 1.000000
vt 0.500000 0.937500
vt 0.250000 0.937500
vt 0.250000 0.750000
vt 0.500000 0.750000
vt 0.937500 0.312500
vt 0.937500 0.062500
vt 1.000000 0.000000
vt 1.000000 0.375000
vt 0.687500 0.062500
vt 0.625000 0.000000
vt 0.687500 0.312500
vt 0.625000 0.375000
vt 0.250000 0.000000
vt 0.250000 0.250000
vt 0.000000 0.250000
vt 0.000000 0.000000
vt 0.750000 0.937500
vt 0.500000 0.937500
vt 0.500000 0.750000
vt 0.750000 0.750000
vt 1.000000 0.937500
vt 0.750000 0.937500
vt 0.750000 0.750000
vt 1.000000 0.750000
vt 0.000000 0.937500
vt 0.000000 0.750000
vt 0.312500 0.375000
vt 0.312500 0.500000
vt 0.000000 0.500000
vt 0.000000 0.375000
vt 0.375000 0.375000
vt 0.375000 0.500000
vn 0.0000 -1.0000 0.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 1.0000 0.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 0.0000 -1.0000
vn 0.0000 0.0000 1.0000
usemtl Material.002
s off
f 1/1/1 9/2/1 10/3/1 3/4/1
f 3/4/2 10/3/2 11/5/2 7/6/2
f 7/7/3 11/8/3 12/9/3 5/10/3
f 5/11/4 12/12/4 9/13/4 1/14/4
f 3/15/5 7/16/5 5/17/5 1/18/5
f 6/19/1 8/20/1 15/21/1 16/22/1
f 2/23/6 4/24/6 10/25/6 9/26/6
f 4/24/6 8/27/6 11/28/6 10/25/6
f 8/27/6 6/29/6 12/30/6 11/28/6
f 6/29/6 2/23/6 9/26/6 12/30/6
f 15/31/6 14/32/6 13/33/6 16/34/6
f 4/35/3 2/36/3 13/37/3 14/38/3
f 2/39/2 6/40/2 16/41/2 13/42/2
f 8/20/4 4/43/4 14/44/4 15/21/4
f 18/45/5 17/46/5 19/47/5 20/48/5
f 17/46/1 18/45/1 22/49/1 21/50/1

View File

@ -0,0 +1,100 @@
# Blender v3.0.0 Beta OBJ File: ''
# www.blender.org
mtllib mcl_rubber_treetap_4.mtl
o treetap_4_Cube.008
v 0.187500 -0.500000 -0.250000
v 0.125000 -0.437500 0.187500
v -0.187500 -0.500000 -0.250000
v -0.125000 -0.437500 0.187500
v 0.187500 -0.125000 -0.250000
v 0.125000 -0.187500 0.187500
v -0.187500 -0.125000 -0.250000
v -0.125000 -0.187500 0.187500
v 0.187500 -0.500000 0.187500
v -0.187500 -0.500000 0.187500
v -0.187500 -0.125000 0.187500
v 0.187500 -0.125000 0.187500
v 0.125000 -0.437500 0.125000
v -0.125000 -0.437500 0.125000
v -0.125000 -0.187500 0.125000
v 0.125000 -0.187500 0.125000
v 0.062500 -0.312500 0.250000
v -0.062500 -0.312500 0.250000
v 0.062500 -0.625000 0.250000
v -0.062500 -0.625000 0.250000
v 0.062500 -0.312500 0.187500
v -0.062500 -0.312500 0.187500
vt 0.750000 0.500000
vt 0.750000 0.937500
vt 0.375000 0.937500
vt 0.375000 0.500000
vt 0.000000 0.937500
vt 0.000000 0.500000
vt 1.000000 0.500000
vt 1.000000 0.937500
vt 0.625000 0.937500
vt 0.625000 0.500000
vt 0.687500 0.500000
vt 0.687500 0.937500
vt 0.312500 0.937500
vt 0.312500 0.500000
vt 0.000000 1.000000
vt 0.000000 0.625000
vt 0.375000 0.625000
vt 0.375000 1.000000
vt 0.500000 0.937500
vt 0.250000 0.937500
vt 0.250000 0.875000
vt 0.500000 0.875000
vt 0.937500 0.312500
vt 0.937500 0.062500
vt 1.000000 0.000000
vt 1.000000 0.375000
vt 0.687500 0.062500
vt 0.625000 0.000000
vt 0.687500 0.312500
vt 0.625000 0.375000
vt 0.250000 0.000000
vt 0.250000 0.250000
vt 0.000000 0.250000
vt 0.000000 0.000000
vt 0.750000 0.937500
vt 0.500000 0.937500
vt 0.500000 0.875000
vt 0.750000 0.875000
vt 1.000000 0.937500
vt 0.750000 0.937500
vt 0.750000 0.875000
vt 1.000000 0.875000
vt 0.000000 0.937500
vt 0.000000 0.875000
vt 0.312500 0.375000
vt 0.312500 0.500000
vt 0.000000 0.500000
vt 0.000000 0.375000
vt 0.375000 0.375000
vt 0.375000 0.500000
vn 0.0000 -1.0000 0.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 1.0000 0.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 0.0000 -1.0000
vn 0.0000 0.0000 1.0000
usemtl Material.002
s off
f 1/1/1 9/2/1 10/3/1 3/4/1
f 3/4/2 10/3/2 11/5/2 7/6/2
f 7/7/3 11/8/3 12/9/3 5/10/3
f 5/11/4 12/12/4 9/13/4 1/14/4
f 3/15/5 7/16/5 5/17/5 1/18/5
f 6/19/1 8/20/1 15/21/1 16/22/1
f 2/23/6 4/24/6 10/25/6 9/26/6
f 4/24/6 8/27/6 11/28/6 10/25/6
f 8/27/6 6/29/6 12/30/6 11/28/6
f 6/29/6 2/23/6 9/26/6 12/30/6
f 15/31/6 14/32/6 13/33/6 16/34/6
f 4/35/3 2/36/3 13/37/3 14/38/3
f 2/39/2 6/40/2 16/41/2 13/42/2
f 8/20/4 4/43/4 14/44/4 15/21/4
f 18/45/5 17/46/5 19/47/5 20/48/5
f 17/46/1 18/45/1 22/49/1 21/50/1

View File

@ -0,0 +1,239 @@
-- Helper stuff ----------------------------------------------------------------
local S = minetest.get_translator(minetest.get_current_modname())
local modpath = minetest.get_modpath(minetest.get_current_modname())
-- Main Part of the Mod --------------------------------------------------------
minetest.register_node("mcl_rubber:rubberblock", {
description = S("Rubber Block"),
_doc_items_longdesc = S("Rubber blocks are bouncy and prevent fall damage."),
is_ground_content = false,
tiles = {"mcl_rubber_block.png"},
stack_max = 64,
groups = {dig_immediate=3, bouncy=55,fall_damage_add_percent=-100,deco_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 1.5,
_mcl_hardness = 1.5,
})
minetest.register_craftitem("mcl_rubber:rubber_raw", {
description = S("Rubber Resin"),
_doc_items_longdesc = S("Rubber Resin is the ingredient to make Rubber."),
inventory_image = "mcl_rubber_raw.png",
groups = { craftitem = 1 },
})
minetest.register_craftitem("mcl_rubber:rubber", {
description = S("Rubber"),
_doc_items_longdesc = S("Rubber is used in crafting. It is made from Rubber Resin"),
inventory_image = "mcl_rubber.png",
groups = { craftitem = 1, rubber = 1 },
})
minetest.register_craft({
output = "mesecons_pistons:piston_sticky_off",
recipe = {
{"mcl_rubber:rubber_raw"},
{"mesecons_pistons:piston_normal_off"},
},
})
minetest.register_craft({
output = "mcl_rubber:rubber 9",
recipe = {{"mcl_rubber:rubberblock"}},
})
minetest.register_craft({
output = "mcl_rubber:rubberblock",
recipe = {{"group:rubber","group:rubber","group:rubber",},
{"group:rubber","group:rubber","group:rubber",},
{"group:rubber","group:rubber","group:rubber",}},
})
minetest.register_craft({
type = "cooking",
output = "mcl_rubber:rubber",
recipe = "mcl_rubber:rubber_raw",
cooktime = 10,
})
-- register rubber boots
minetest.register_tool("mcl_rubber:boots", {
description = S("Rubber Boots"),
_doc_items_longdesc = mcl_armor.longdesc,
_doc_items_usagehelp = mcl_armor.usage,
inventory_image = "mcl_rubber_boots_inv.png",
groups = {
armor = 1,
combat_armor = 1,
armor_boots = 1,
mcl_armor_uses = 80,
fall_damage_add_percent = -60,
enchantability = 5,
},
sounds = {
_mcl_armor_equip = "mcl_armor_equip_leather",
_mcl_armor_unequip = "mcl_armor_unequip_leather",
},
on_place = mcl_armor.equip_on_use,
on_secondary_use = mcl_armor.equip_on_use,
_mcl_armor_element = "feet",
_mcl_armor_texture = "mcl_rubber_boots.png"
})
minetest.register_craft({
output = "mcl_rubber:boots",
recipe = {
{"group:rubber", "", "group:rubber"},
{"group:rubber", "", "group:rubber"},
},
})
-- register rubber tree stuff
biolib.register_tree_trunk(
"mcl_rubber:rubbertree",
S("Rubber Wood"),
S("Rubber Bark"),
S("The trunk of a rubber tree."),
"mcl_rubber_tree_top.png",
"mcl_rubber_tree.png",
"mcl_rubber:stripped_rubbertree")
biolib.register_stripped_trunk(
"mcl_rubber:stripped_rubbertree",
S("Stripped Rubber Wood Log"),
S("Stripped Rubber Wood"),
S("The stripped trunk of a rubber tree."),
S("The stripped wood of an rubber tree."),
"mcl_rubber_stripped_top.png",
"mcl_rubber_stripped.png")
biolib.register_planks(
"mcl_rubber:rubberwood",
S("Rubber Wood Planks"),
{"mcl_rubber_planks.png"})
biolib.register_wooden_stairs(
"rubberwood",
"mcl_rubber:rubberwood",
"mcl_rubber_planks.png",
S("Rubber Wood Stairs"),
S("Rubber Wood Slab"),
S("Double Rubber Wood Slab"))
biolib.register_wooden_fence(
"rubberwood",
"mcl_rubber:rubberwood",
S("Rubber Wood Fence"),
S("Rubber Wood Fence Gate"),
"mcl_rubber_fence.png")
biolib.register_sapling(
"mcl_rubber:rubbersapling",
S("Rubber Tree Sapling"),
S("When placed on soil (such as dirt) and exposed to light, an rubber tree "
.."sapling will grow into a rubber tree after some time."),
S("Needs soil and light to grow"),
"mcl_rubber_sapling.png",
{-4/16, -0.5, -4/16, 4/16, 0.5, 4/16})
biolib.register_leaves(
"mcl_rubber:rubberleaves",
S("Rubber Tree Leaves"),
S("Rubber Tree leaves are grown from rubber trees."),
{"mcl_rubber_leaves.png"},
"mcl_rubber:rubbersapling",
{40, 26, 32, 24, 10},
{"mcl_rubber:rubber_raw", {200, 180, 160, 120, 40}})
-- treetap stuff
for i=0,4 do
biolib.register_treetap_variant(
"mcl_rubber:treetap",
S("Treetap"),
S("Collects Rubber Resin, when attached to rubber trees."),
S("The treetap is a block, that gets attached to Rubber Trees to collect "
.."their resin, for creating Rubber."),
S("Place the treetap next to the log of a rubber tree. This will attach "
.."the treetap, and allow it to collect resin over time. Make sure to "
.."not attach too many on it, because that will reduce the "
.."effectiveness. Rightclick for dropping the resin, when done."),
"mcl_rubber_treetap",
"mcl_rubber:rubbertree",
"mcl_rubber:rubber_raw",
i)
if minetest.get_modpath("doc") and i>0 then
doc.add_entry_alias("nodes", "mcl_rubber:treetap", "nodes", "mcl_rubber:treetap_"..i)
end
end
local treetap_update_action = mcl_rubber.treetap_update_action("mcl_rubber:treetap")
biolib.register_world_updates(
{"mcl_rubber:treetap",
"mcl_rubber:treetap_1",
"mcl_rubber:treetap_2",
"mcl_rubber:treetap_3"},
{"mcl_rubber:rubbertree"},
"Treetap update",
"Fills treetap in unloaded areas",
"mcl_rubber:lbm_treetap",
20, 15,
treetap_update_action)
minetest.register_craft({
output = "mcl_rubber:treetap",
recipe = {
{"", "mcl_core:iron_ingot", ""},
{"group:wood", "", "group:wood"},
{"group:wood", "group:wood", "group:wood"},
},
})
-- generation stuff
local rubber_sapling_grow = mcl_rubber.rubber_sapling_grow_action(1, "mcl_rubber:rubbersapling", 11)
biolib.register_bonemeal_sapling("mcl_rubber:rubbersapling", rubber_sapling_grow)
biolib.register_world_updates(
{"mcl_rubber:rubbersapling"},
{"group:soil_sapling"},
"Rubber tree growth",
"Add growth for unloaded rubber tree",
"mcl_rubber:lbm_rubber",
25, 2,
rubber_sapling_grow)
for i=1,3 do
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:soil_sapling"},
sidelen = 16,
fill_ratio = 0.00007,
biomes = {"Forest", "Jungle", "JungleM", "JungleEdge"},
y_max = 200,
y_min = 1,
schematic = modpath .. "/schematics/mcl_rubber_tree_"..i..".mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:soil_sapling"},
sidelen = 16,
fill_ratio = 0.0000003,
biomes = {"Plains"},
y_max = 200,
y_min = 1,
schematic = modpath .. "/schematics/mcl_rubber_tree_"..i..".mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
end
-- register event based stuff
minetest.register_on_player_hpchange(biolib.do_modify_falldamage_with_boots, true)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

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