Presentation is loading. Please wait.

Presentation is loading. Please wait.

Making something known

Similar presentations


Presentation on theme: "Making something known"— Presentation transcript:

1 Making something known
GameRegistry Making something known Copyright © 2015 Curt Hill

2 Introduction We have seen this twice up until now
We used it to register a block and item Until something is registered it does not exist to the game Using an unregistered item generally crashes the server Copyright © 2015 Curt Hill

3 Instantiation Almost every thing in GameRegistry is static
Thus, no copy of this thing exists or needs to be instantiated There are two static nested classes but mostly it is just a collection of methods Static methods and properties function like global variables and functions Except that they need the class name as a prefix Copyright © 2015 Curt Hill

4 What you have seen static Block registerBlock( Block, String)
static Item registerItem( Item, String name, String ID) Copyright © 2015 Curt Hill

5 What you will see addRecipe addShapedRecipe addShapelessRecipe
addSmelting Several of these exist in several signatures We will consider them in subsequent presentations Copyright © 2015 Curt Hill

6 Finds There are three find methods that we should consider Today:
findBlock and findItem These allow us to find registered things Maybe later findItemStack Copyright © 2015 Curt Hill

7 Find Block Signature: static Block findBlock (String modId, String name) The first parameter is the modid I have been using “curtmod” If it is a standard thing use “minecraft” The second is the block name If the block is not found you get a null returned, otherwise a handle Always check if this has been successful Copyright © 2015 Curt Hill

8 Find Item Signature: static Item findItem (String modId, String name)
The first parameter is the modid I have been using “curtmod” If it is a standard thing use “minecraft” The second is the item name If the item is not found you get a null returned, otherwise a handle Always check if this has been successful Copyright © 2015 Curt Hill

9 Finally GameRegistry is the heart of what Minecraft knows about its contents We will use this anytime we create a new block or item We may also use this when we deal with behaviors Copyright © 2015 Curt Hill


Download ppt "Making something known"

Similar presentations


Ads by Google