Pack Making JSON Custom Items - DonBruce64/MinecraftTransportSimulator GitHub Wiki

While allowing users to craft vehicles is great, it can get a bit un-realistic to make a truck out of stacks of iron ingots and glass. To help with this, MTS allows for making custom items. These items are loaded via JSON like all other vehicle bits, but rather than use an OBJ model they use the normal Minecraft item JSON format. This allows you to take any JSON outputted from any modeling software (such as BlockBench) and plop it, along with a small file in the jsondefs section, into your pack for crafting use!

While having a huge selection of parts, items, vehicles, and bumper stickers is all well and good, having your users get confused about how to use such things is not. To that end, items can have booklet functionality, providing a simple way for you to add information to your pack. Need to explain how your frame-up building system works? Booklets. Need to pass around some marketing material? Booklets. Need write a tirade on why [Other Pack] sucks? Who am I to stop you from making a booklet of that?

The final type of item you can make are food-based items. These are pretty self-explanatory.

Inherited JSON

Items inherit the following core JSON sections:

Item

The item section is common to all items, and has the following parameters:

  • type – This parameter is optional. If included, the item will be created with specific functionality. The following special types are currently supported:
  • none – Creates a base item with no functionality.
  • booklet – Creates a booklet, which is a book-like item.
  • food – Creates an item that can be eaten.
  • weapon – Creates an item that can be used as a weapon.
  • scanner – Creates an item that functions like a parts scanner.
  • wrench – Creates an item that functions like a wrench.
  • paint_gun – Creates an item that functions like a paint gun.
  • key – Creates an item that functions like a key.
  • ticket – Creates an item that functions like a ticket.
  • fuel_hose – Creates an item that functions like a fuel hose.
  • jumper_cables – Creates an item that functions like jumper cables.
  • jumper_pack – Creates an item that functions like a jumper pack.
  • repair_pack – Creates an item that functions like a repair pack.
  • y2k_button – Creates an item that functions like a Y2K button.

Booklet

This section is only present on booklet items. It has the following parameters:

  • disableTOC – If present and true, the Table of Contents will not be created. Useful for small booklets where one is not needed, or large booklets where one would overflow.
  • textureWidth – How wide of a texture, in px, this booklet uses. Used for ALL pages.
  • textureHeight – How high of a texture, in px, this booklet uses. Used for ALL pages.
  • coverTexture – The name of the texture for the cover. Should be prefixed by your modID and MUST be a power of 2.
  • titleText – A list of text objects that make up the text for the title.
  • pages – A list of Page objects that make up the pages of this booklet.

Pages

Each booklet consists of multiple pages. Each page has multiple text sections. By defining multiple pages and text sections, you can make a booklet with text literally anywhere. Pages contain the following parameters:

  • pageTexture – The name of the texture for this page. Each page may use a different texture, if desired. However, all textures MUST be the same resolution as defined by textureWidth and textureHeight.
  • title – The title for this page that will be used to make the Table of Contents. May be omitted if the Table of Contents is disabled.
  • pageText – An array of text objects that make up the text for the page. The only difference between these and most other text instances is the z-coord should always be 0, and the defaultText parameter is what will be rendered in the booklet.

Food

This section is only present on food items. It has the following parameters:

  • isDrink– The animation to play while consuming this item. If true, the drinking animation is played. If false, the eating animation is played.
  • timeToEat – How long, in ticks, it takes to eat this food item.
  • hungerAmount – How much hunger this food item fills. Must be a whole number.
  • saturationAmount – How much saturation this food has. May be a decimal.
  • effects – A optional list of effects.

Weapon

This section is only present on weapons. It has the following parameters:

  • attackDamage – How much damage this weapon will inflict when it hits an entity.
  • attackCooldown – How long, in ticks, between each strike of this weapon.

Repair

This section is only present on repair packs. It has the following parameters:

  • canRepairTotaled – Normally, repair packs cannot repair totaled vehicles. This allows them to do so.
  • amount – How much health repair pack restores.