Git Product home page Git Product logo

minecraftbyexample's Introduction

MinecraftByExample [1.12.2]

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 worth 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 parts of the code which are common to more than one example are the MinecraftByExample, CommonProxy, ClientOnlyProxy, and DedicatedServer classes, which can be found here.

If you want more information and explanatory text about the concepts, the following links might be useful:

####For earlier versions, see the relevant GitHub branch:

##List of examples

Blocks

  • 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
  • MBE04 - a camouflage ("secret door") block which dynamically changes its appearance to match adjacent blocks - uses IBlockModel.getQuads() and onModelBakeEvent()
  • MBE05 - a 3D web which joins to neighbours in all six directions - uses IBlockModel.getQuads() and ICustomModelLoader
  • MBE06 - several different types of block which use redstone
  • MBE08 - how to add a creative tab for organising your custom blocks / items

Items

  • MBE10 - a simple item
  • 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
  • MBE13 - customise Mining behaviour of Blocks and Items - several test classes that show how mining works
  • MBE14 - an interactive helper tool to adjust the ItemCameraTransforms for your custom item
  • MBE15 - a chessboard item with 1 - 64 pieces; uses ItemOverrideList.handleItemState(), 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 TileEntitySpecialRenderer 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

Recipes (Crafting/Furnace)

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

Heads Up Display/Overlays

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

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

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

Testing tools

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

Usage

  • 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:

    1. Download the project as a zip.
    2. 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)
    3. From the command line, run gradlew setupDecompWorkspace to install Forge and configure the project, this will take quite some time, maybe 20 minutes or more.
    4. From the command line, run gradlew idea if you are using IntelliJ IDEA, or gradlew eclipse if you are using Eclipse.
    5. If using IntelliJ:
      1. Open the project (open the MinecraftByExample.ipr file).
      2. It will ask you whether you want to import the "unlinked gradle project". This is optional. If you choose no, later on (when you publish your mod) you will need to package it up using the command line gradlew build, if you choose yes you can run the gradle build task from inside IntelliJ. For most users, there's no other difference.
      3. If you imported the gradle project, you should run the gradle task 'genIntellijRuns' afterwards to get the Run and Debug configurations.
    6. If using Eclipse:
      1. Open the Project.
      2. Right click on the project, select "Run As" > "Run Configurations..."
      3. Set the main class to "GradleStart"
    7. You should be able to start Minecraft now (using the Run or Debug configuration) and the mod will be loaded.

If You're Still Confused

Head over here if this didn't make sense to you, alternatively this tutorial 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

minecraftbyexample's People

Contributors

alvaropp avatar dovahofkiin avatar matshou avatar mrbitsage avatar shadowfacts avatar vladh avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.