Copyright © 2013-2015 Curt Hill Sounds, Resource Packs, JSON What more would you want?

Slides:



Advertisements
Similar presentations
Introduction to FX Equation 4. The Basic Idea FX Equation is DIFFERENT. Most equation editors use a point and click interface that has you searching for.
Advertisements

 Use the Left and Right arrow keys or the Page Up and Page Down keys to move between the pages. You can also click on the pages to move forward.  To.
15-Jun-15 Beginning Style. 2 Be consistent! Most times, you will enter an ongoing project, with established style rules Follow them even if you don’t.
CIS101 Introduction to Computing Week 11. Agenda Your questions Copy and Paste Assignment Practice Test JavaScript: Functions and Selection Lesson 06,
CIS101 Introduction to Computing Week 12 Spring 2004.
15-Jul-15 JSON. JSON example “JSON” stands for “JavaScript Object Notation” Despite the name, JSON is a (mostly) language-independent way of specifying.
Creating a MagicInfo Pro Screen Template
Lab 8 – C# Programming Adding two numbers CSCI 6303 – Principles of I.T. Dr. Abraham Fall 2012.
Computer Science 1000 Spreadsheets II Permission to redistribute these slides is strictly prohibited without permission.
Copyright © Curt Hill PhP History and Introduction.
Copyright 2007, Information Builders. Slide 1 Maintain & JavaScript: Two Great Tools that Work Great Together Mark Derwin and Mark Rawls Information Builders.
XP New Perspectives on Microsoft Access 2002 Tutorial 41 Microsoft Access 2002 Tutorial 4 – Creating Forms and Reports.
Copyright ©: SAMSUNG & Samsung Hope for Youth. All rights reserved Tutorials Software: Building apps Suitable for: Advanced.
CS378 - Mobile Computing Web - WebView and Web Services.
JSON The Fat Free Alternative to XML. Data Interchange The key idea in Ajax. An alternative to page replacement. Applications delivered as pages. How.
Copyright © 2015 Curt Hill Building a Simple Level Adding Some Standard Actors.
Copyright © 2015 – Curt Hill Minecraft Blocks Properties and Methods.
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
Playing Music in Alice By David Yan Under the direction of Professor Susan Rodger July 2015.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Copyright © 2015 Curt Hill Environment Establishing one for Minecraft Modding.
CREATING TEMPLATES CREATING CUSTOM CHARACTERS IMPORTING BATCH DATA SAVING DATA & TEMPLATES CREATING SERIES DATA PRINTING THE DATA.
Serialization. Serialization is the process of converting an object into an intermediate format that can be stored (e.g. in a file or transmitted across.
Copyright © Curt Hill Turtles The beginning of media computation.
Copyright © 2015 Curt Hill Typing Your Commands Console, Command Line and Movies.
An Introduction to Designing and Executing Workflows with Taverna Aleksandra Pawlik materials by: Katy Wolstencroft University of Manchester.
Hello World in the Forte IDE An introduction to the Forte IDE (integrated development environment) writing the classic “Hello World” program in Java.
1 Week 12 l Overview of Streams and File I/O l Text File I/O Streams and File I/O.
Java 5 Part 1 CSE301 University of Sunderland Harry Erwin, PhD.
Copyright © Curt Hill Generic Classes Template Classes or Container Classes.
Playing Music in Alice By David Yan Under the direction of Professor Susan Rodger July 2015.
Using Action Buttons in Microsoft PowerPoint Creating a PowerPoint Jeopardy Game By Aaron Driscoll.
Term 2, 2011 Week 1. CONTENTS Problem-solving methodology Programming and scripting languages – Programming languages Programming languages – Scripting.
JSON Java Script Object Notation Copyright © 2013 Curt Hill.
Data TypestMyn1 Data Types The type of a variable is not set by the programmer; rather, it is decided at runtime by PHP depending on the context in which.
Introduction to Web Services. Examples Using a Web Service Creating a new Web Service.
Game Maker – Getting Started What is Game Maker?.
Chapter 4 Introduction to Classes, Objects, Methods and strings
Copyright Curt Hill Variables What are they? Why do we need them?
Fall 2003Sylnovie Merchant, Ph.D. ACCESS Tutorial Note: The purpose of this tutorial is to provide an introduction to some of the functions of ACCESS in.
Typing and Formatting a Research Paper WORD 2013.
Copyright © Curt Hill Tortoise SVN A Subversion Client.
How to Setup and Score a Tournament May Let’s Get Organized The setup and organization outlined in this clinic are suggested steps however can be.
Tutorial for Arrays and Lists. Description This presentation will cover the basics of using Arrays and Lists in an Alice world It uses a set of chickens.
Parser Generation Using SLK and Flex++ Copyright © 2015 Curt Hill.
Web Services An Introduction Copyright © Curt Hill.
Module 5 GemStall Overview
1 Week # 4 Introduction to PDM PDM is a workbench environment that lets programmers and system operators navigate the three levels of the AS/400’s object-based.
Recipes How to craft items from others Copyright © 2015 Curt Hill.
Copyright © – Curt Hill Building Windows Applications in wxDev-C++
OVERVIEW AND PARSING JSON. What is JSON JavaScript Object Notation Used to format data Commonly used in Web as a vehicle to describe data being sent between.
M1G Introduction to Programming 2 2. Creating Classes: Game and Player.
JSON. JSON as an XML Alternative JSON is a light-weight alternative to XML for data- interchange JSON = JavaScript Object Notation It’s really language.
JSON (Copied from and from Prof Da Silva) Week 12 Web site:
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
Invoices and Service Invoices Training Presentation for Raytheon Supply Chain Platform (RSCP) April 2016.
Today Javadoc. Packages and static import. Viewing API source code. Upcoming Topics: –protected access modifier –Using the debugger in Eclipse –JUnit testing.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
CS0007: Introduction to Computer Programming Primitive Data Types and Arithmetic Operations.
HTML Again GUI Items Originally HTML 4 Copyright © Curt Hill.
Built in Fairfield County: Front End Developers Meetup
GDSS – Digital Signature
New Perspectives on Windows XP
Cmdlets “Command-lets”
Copyright © – Curt Hill Bash Flow of Control Copyright © – Curt Hill.
The Java Alternative to Multiple Inheritance
Department of Computer Science Cal State East Bay, Hayward, CA
Introducing JavaScript
Running a Java Program using Blue Jay.
Presentation transcript:

Copyright © Curt Hill Sounds, Resource Packs, JSON What more would you want?

Introduction A resource pack allows replacement of a series of textures, sounds or music to be installed instead of the standard Minecraft versions In order to add new sounds we will put them in a resource pack –Then figure out how to use them We will need JSON as well –That is where we will start Copyright © Curt Hill

What is JSON? JavaScript Object Notation A language for data interchange –Derived from JavaScript (ECMA standard) –Alternative to XML in that respect Both easy for people to read and easy for machines to parse Consists of sequences and attribute- value pairs It is an open standard Copyright © Curt Hill

Simple Types Does not have many Number –A floating point type String –Enclosed in double quotes –Uses UNICODE characters Boolean –May be true or false null –Indicates an empty value Copyright © Curt Hill

Structured Types Only two structuring types Object –Similar to a group, record, or struct, depending on language –Unordered, comma separated list of name value pairs enclosed in braces { } –The key is separated from the value by a colon Array –An ordered, comma separated list of values enclosed in brackets [ ] Copyright © Curt Hill

Commentary White space may be interspersed for readability without changing meaning Hardly any programming language lacks these features –Most have a JSON interface Keys are merely strings –Enclosed in double quotes Copyright © Curt Hill

Example A simple object to contain a name: { “first”:”Bill”, “lastname”: “Smith” } An array of names inside an object: { “employees” : [ {“first”:”Bill”, “last”:“Sam” }, {“first”:”John”, “last”:“Doe” }, {“first”:”Curt”, “last”:“Hill” } ] } We will see two examples in resource packs Copyright © Curt Hill

BSON Binary JSON also exists This is a binary encoded serialization of JSON objects These should be more compact and faster to parse This we will not use in this class Copyright © Curt Hill

Resource Packs A resource pack is a zip file containing a directory tree Various parts of this tree contain the resources that Minecraft will replace its native resources We need to look at several parts of this tree –Starting at the root Copyright © Curt Hill

The root directory Contains three things: An assets directory The pack.mcdata file –The first of our two JSON files in this presentation A pack.png file –For display Copyright © Curt Hill

pack.mcdata A JSON file that identifies the resource pack There may be several things in it, but the required information is the name and format of the pack See the next slide for an example Copyright © Curt Hill

Required Example Copyright © Curt Hill { "pack": { "description": "Curt's Minecraft Resources", "pack_format": 1 }

Other things There may be other things in this file as well The template resource pack contains numerous language types Copyright © Curt Hill

Directory Structure Copyright © Curt Hill

Moving Down The assets directory is rooted in the top level directory It only contains the minecraft directory Inside the minecraft directory are several resource directories There is also the sounds.json file Copyright © Curt Hill

Minecraft directory Contains as many of the following subdirectories as you want to use: –icons –music –records –sounds –textures Today we are only interested in sounds Copyright © Curt Hill

Sounds Directory May contain 15 or more subdirectories Again, these depend on what you want to replace These include: –Damage –Dig –Fire –Mob –Music –Step –Among others Copyright © Curt Hill

Example: Step Directory This contains the noise made when an entity steps on a particular type of block Usually there are several alternatives so the exact same noise is not used for every step In the template there are 4 cloth, 6 grass, 4 gravel etc. Copyright © Curt Hill

Built ins and not Most of the sounds are built-in –Their presence in the correct directory is all that is needed Should you add something another file is needed: sound.json Yet another JSON file that gives additional control information to the game Sounds that are not standard need an entry in this file Copyright © Curt Hill

The sounds.json file First recall that this file is in the assets/minecraft directory It has one or more entries that give a name to a sound and then describe its location –Possibly other things as well Copyright © Curt Hill

Minimal Example File Copyright © Curt Hill { "lightblock": { "category": "neutral", "sounds": [ "step/lightblock" ] }, "step.lightblock": { "category": "neutral", "sounds": [ "step/lightblock" ] }

Commentary This file gave two names for the same file –This is done in two entries First entry is the name –This identifies an object The object may contain two or more entries –Only two were shown: category and sounds Copyright © Curt Hill

Object entries Category determines the volume controls Several options here: –ambient –weather –player –neutral –block –record –Among others Copyright © Curt Hill

Volume Controls Copyright © Curt Hill

Testing Once we have established a named sound in: –The resource pack –sounds.json We should be able to use it In the client we should be able to type: /playsound –The sound should play or the console record the error Copyright © Curt Hill

Playing Copyright © Curt Hill

Played Copyright © Curt Hill

Commentary The screen said it was played, but what he really means is that he tried to play it The console will have a complaint if it tried to play it but could not find it Later we will consider the Java code to play it Before that we continue with the resource pack Copyright © Curt Hill

Template Pack A template resource pack is at: resource-pack-template.7540/ resource-pack-template.7540/ This is the basis of what I have used Download and extract it to a directory –Not your minecraft directory Then modify it to suit Copyright © Curt Hill

Modification Modify the pack.mcdata and pack.png –Only the name of the resource pack Create and edit the new sounds Add these new sounds to whichever directory seems appropriate Create and add the sounds.json file to the minecraft directory Rezip it and copy to the correct directory Copyright © Curt Hill

Rezip There are several zip utilities The built-in in Windows Explorer is the easiest Enter the top level directory Select all of these –assets directory –pack.mcdata –pack.png Right click and choose Send to compressed file Rename it to your own name Copyright © Curt Hill

Getting Minecraft to use it The resource file needs to be in a particular directory This can be easily found by clicking the options and resource buttons Then click on Open Resource Pack folder –This will open a Windows Explorer in the right directory Copyright © Curt Hill

Selected Resource Packs Copyright © Curt Hill

Finding location Copyright © Curt Hill

Selection Once Minecraft knows it is available it should be in the left column Move to right column Make it first Now it should be available when you play Next we consider sounds and playing them at appropriate times Copyright © Curt Hill

Sounds We have already seen the Block method setStepSound It takes as a parameter a Block.SoundType class Up to now we have used one of the constant sounds: –soundTypeAnvil, soundTypeCloth, soundTypeGlass, soundTypeGrass, soundTypeGravel, soundTypeMetal, soundTypeSand, etc. Now we want more Copyright © Curt Hill

Block.SoundType A class in its own right Has three properties: –float frequency –String soundName –float volume The constructor takes all three –Name, frequency, volume Copyright © Curt Hill

Constructor Again The frequency is more like playback speed 1.0F means normal –Less than one means slow it down –More than one speeds it up The volume should be between 0-1 –Moderated by sliders The name is the name in sounds.json This is usually used inside the setStepSound or similar method Copyright © Curt Hill

Ways to play sound Blocks contain the setStepSound –Strangely, there is no setDigSound method The other way is playSound –This is a method in Entity Copyright © Curt Hill

setStepSound We have seen this using a constant sound Here is the example using a new sound: setStepSound( new Block.SoundType ("lightblock",1.0F,1.0F)); The lightblock is in the sounds.json file Copyright © Curt Hill

playSound This one is somewhat different It is a member of Entity The signature is: void playSound(String name, float freq, float vol); – Where Freq is the playback speed Vol is the volume Copyright © Curt Hill

Where? The playSound method may be used in anything with access to an Entity In particular this is usually in event handlers: –onEntityWalking –onEntityCollidedWithBlock These both have a parameter that gives the entity that did the action Copyright © Curt Hill

Finally Now we know about using sounds –Putting them in resource packs –Construction JSON files that describe Time for the demo Copyright © Curt Hill