** Work in Progress **
The purpose of MinecraftByExample is to give simple working examples of the important concepts in Minecraft and Forge. If you're anything like me, a good code example is worth several screens of waffling explanation, and can very quickly explain the key concepts. I also find it much easier to adapt and debug something that already works, than to have to synthesize something from scratch and spend hours trying to discover the missing bit of information I didn't know about.
I've tried to keep the code simple and obvious and to resist the urge to be clever. The examples might not be the most efficient or succinct implementation, I've deliberately left the optimization to you.
Each example is split up to be totally independent of all the others. The only part of the code which is common to more than one example is the MinecraftByExample class.
If you want more information and explanatory text about the concepts, the following links might be useful:
- The Official Forge documentation
- Guide to how Minecraft works (still being updated from 1.8 to 1.14.4+)
- Fabric Wiki (some of it is specific to the Fabric API, but a lot of useful general info too)
- Forge modder support forum
- MBE for Forge 1.8: 1-8final
- MBE for Forge 1.8.9: 1-8-9final
- MBE for Forge 1.10.2: 1-10-2final
- MBE for Forge 1.11: 1-11final
- MBE for Forge 1.11.2: 1-11-2final
- MBE for Forge 1.12.2: 1-12-2final
- MBE for Forge 1.14.4: 1-14-4partial (partially updated only)
If you are updating from previous forge versions, you will probably find this link very helpful. For better or for worse, MCP decided to rename a very large number of classes (eg all Blocks Blockxxx --> xxxxBlock, etc) so this might save you a stack of time. If you use IntelliJ, you might find these xml mapping files useful too
** examples marked with "x" haven't been converted yet **
- MBE01 - a simple cube
- MBE02 - a block with a more complicated shape
- MBE03 - a block (coloured signpost) with multiple variants- four colours, can be placed facing in four directions
- X MBE04 - a camouflage ("secret door") block which dynamically changes its appearance to match adjacent blocks - uses IBlockModel.getQuads() and onModelBakeEvent()
- X MBE05 - a 3D web which joins to neighbours in all six directions - uses IBlockModel.getQuads() and ICustomModelLoader
- X MBE06 - several different types of block which use redstone
- X MBE08 - how to add a creative tab for organising your custom blocks / items
- MBE10 - a simple item
- MBE11 - an item with multiple variants - rendered using multiple models and multiple layers
- X MBE12 - an item that stores extra information in NBT, also illustrates the "in use" animation similar to drawing a bow
- X MBE13 - customise Mining behaviour of Blocks and Items - several test classes that show how mining works
- X MBE14 - an interactive helper tool to adjust the ItemCameraTransforms for your custom item
- X MBE15 - a chessboard item with 1 - 64 pieces; uses ItemOverrideList.handleItemState(), IBlockModel.getQuads() and onModelBakeEvent()
- X MBE20 - using a tile entity to store information about a block - also shows examples of using NBT storage
- X MBE21 - using the TileEntitySpecialRenderer to render unusual shapes or animations
- X MBE30 - a simple container for storing items in the world - similar to a Chest
- X MBE31 - a functional container such as a Furnace or Crafting Table
- X MBE35 - some typical example crafting recipes and furnace (smelting) recipes
- X MBE40 - simple customisations of the heads up display (hotbar, health meter)
- MBE45 - custom commands
- X MBE50 - shows how to use vanilla Particles; also how to generate your own custom Particles
- X MBE60 - send network messages between client and server
- X MBE70 - configuration file linked to the "mod options" button GUI on the mods list screen
- X MBE75 - a tool to help you automate testing of your classes in-game.
-
You can browse directly in GitHub, or alternatively, download it as a zip and browse it locally.
-
If you want to install it and compile it, the basic steps for beginners are:
- Download the project as a zip.
- Unzip it to an appropriate folder on your computer, such as My Documents. (Or, if you know how to fork a project on GitHub and import it into a local git repository, you can do that instead)
- Look at Forge's README.txt file in this folder and follow the instructions to import it into Eclipse or IntelliJ IDEA.
- Use the gradle task runClient to run or debug the project.
Head over here if this didn't make sense to you, alternatively [this tutorial][diesieben_idea] by diesieben07.
Check out this video for more help installing Forge.
With thanks to these helpful folks: alvaropp, yooksi, Brandon3035, twrightsman (greekphysique), Nephroid, Herbix, and Shadowfacts
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/