Making something known

Slides:



Advertisements
Similar presentations
Road Map Introduction to object oriented programming. Classes
Advertisements

C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
Copyright © 2015 – Curt Hill Minecraft Blocks Properties and Methods.
Lecture Set 11 Creating and Using Classes Part B – Class Features – Constructors, Methods, Fields, Properties, Shared Data.
Peyman Dodangeh Sharif University of Technology Fall 2013.
Copyright Curt Hill Variables What are they? Why do we need them?
Copyright © 2015 Curt Hill Java for Minecraft Those things you should know.
Copyright © Curt Hill Formatting Reals Outputs other than normal.
Recipes How to craft items from others Copyright © 2015 Curt Hill.
Batch Files More flow of control Copyright © by Curt Hill.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 10 Java Fundamentals Objects/ClassesMethods.
Copyright © 2015 – Curt Hill Your First Mod Creating an Item and Block in Eclipse using Forge Annotations! Inheritance! Proxies! Oh my!
Code Generation Instruction Selection Higher level instruction -> Low level instruction Register Allocation Which register to assign to hold which items?
Copyright © 2016 Curt Hill Static Code Analysis What it is and does.
HTML Again GUI Items Originally HTML 4 Copyright © Curt Hill.
ASP.NET Programming with C# and SQL Server First Edition
Lecture 10 Collections Richard Gesick.
Static Code Analysis What it is and does. Copyright © 2016 Curt Hill.
Flow of Control An Overview
Not a Language but a series of techniques
The Lifetime of a Variable
What every server wants!
Chapter 16 UML Class Diagrams.
Dr. Bernard Chen Ph.D. University of Central Arkansas
CSC 108H: Introduction to Computer Programming
The Procedure Abstraction Part IV: Allocating Storage & Establishing Addressability Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights.
Parser and Scanner Generation: An Introduction
This pointer, Dynamic memory allocation, Constructors and Destructor
Fall 2017 CISC124 9/21/2018 CISC124 First onQ quiz this week – write in lab. More details in last Wednesday’s lecture. Repeated: The quiz availability.
Advanced Programming Behnam Hatami Fall 2017.
Predefined Dialog Boxes
Methods Additional Topics
A brief look at some of the new features introduced to the language
A Sorted, Unique Key Container
Concepts From Alice Switching to Java Copyright © Curt Hill.
Exceptions & Error Handling
Objects as Variables Featuring the Date Object
Constants in Java Why and How Copyright © Curt Hill.
Classes & Objects: Examples
Arrays in Java What, why and how Copyright Curt Hill.
Throwing and catching exceptions
BBC Microbit.
Compound Statements A Quick Overview
Other displays Saving Arrays Using fors to process
Cmdlets “Command-lets”
Copyright © – Curt Hill Bash Flow of Control Copyright © – Curt Hill.
Methods Again Parameter Passage
Tonga Institute of Higher Education
Observing how the machine acts
Activation records Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Building a Simple Level
The Java switch Statement
PowerShell Flow of Control Copyright © 2016 – Curt Hill.
Functions, Parameters and Scope
Suggested self-checks: Section 7.11 #1-11
Windows APIs Some odds and ends Copyright © 1997 – 2016 Curt Hill.
Classes, Objects and Methods
Java Looking at our first console application in Eclipse
Classes in Java Specifics for Java Copyright Curt Hill.
This is not an advertisement for the profession
Review for Midterm 3.
The IF Revisited A few more things Copyright © Curt Hill.
Activation records Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
The beginning of media computation Followed by a demo
Creating and Using Classes
Methods Scope How are names handled?
Methods Coding in Java Copyright © Curt Hill.
Putting Values into a Suitable Form for Display
Chapter 4 Test Review First day
Presentation transcript:

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

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

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

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

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

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

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

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

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