Tuesday, 19 May 2020

Minecraft By Example

In parallel with this blog, I created a tutorial project MinecraftByExample.
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.
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.
The topics covered are:

Blocks


  • MBE02 - a block with a more complicated shape


  • MBE03 - two types of blocks which vary their appearance / shape:
a block (coloured signpost) with multiple variants- four colours, can be placed facing in four directions


a block (3D Web) with multiple parts (multipart) similar to a vanilla fence.





  • MBE04 - dynamically created block models
    a camouflage ("secret door") block which dynamically changes its appearance to match adjacent blocks - uses IBlockModel.getQuads(), ModelBakeEvent, IForgeBakedModel and IModelData

an "altimeter" block which shows the block altitude (y coordinate) on the side in digital display - as camouflage block but uses programmatic generation of quads 





  • MBE05 - multilayer block (lantern block with transparent glass) with animated flame texture


  • MBE06 - several different types of block which use redstone


  • MBE08 - how to add a creative tab for organising your custom blocks / items

Items



  • MBE11 - an item with multiple variants - rendered using multiple models and multiple layers

  • 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


  • MBE15 - a chessboard item with 1 - 64 pieces; uses ItemOverrideList.getModelWithOverrides(), IBlockModel.getQuads() and onModelBakeEvent()

TileEntities

  • MBE20 - using a tile entity to store information about a block - also shows examples of using NBT storage

  • MBE21 - using the TileEntityRenderer to render unusual shapes or animations

Containers (Inventories)

  • MBE30 - a simple container for storing items in the world - similar to a Chest

  • MBE31 - a functional container such as a Furnace or Crafting Table


  • MBE32 an item (bag of flowers) which can store other items inside it.  Also shows how to use Capability.




Recipes (Crafting/Furnace)

  • MBE35 - some typical example crafting recipes and furnace (smelting) recipes


Heads Up Display/Overlays

  • X MBE40 - simple customisations of the heads up display (hotbar, health meter)

Commands

  • MBE45 - custom commands

Particles - particle effects

  • MBE50 - shows how to use vanilla Particles; also how to generate your own custom Particles

Network

  • MBE60 - send network messages between client and server

Configuration GUI

  • X MBE70 - configuration file linked to the "mod options" button GUI on the mods list screen

Testing tools

  • X MBE75 - a tool to help you automate testing of your classes in-game.

Entities and Models

  • MBE80 - Shows the basics of Models (eg PigModel), model parameters adjustable in real time using commands




1 comment:

  1. Great work but the X MBE40 Heads Up Display link can't be reached for some reason

    ReplyDelete