Package commoble.databuddy.datagen

# Record Class SimpleModel

java.lang.Object
java.lang.Record
commoble.databuddy.datagen.SimpleModel

Record Components:
  `parent` - ResourceLocation of the parent model
  `textures` - Map of String texture identifiers (specific to this model or its parent) to ResourceLocation ids of textures
  `renderType` - Optional ResourceLocation id of a render type group, see `NamedRenderTypeManager`. If renderType is absent then the block renderer will check for a render type registered to the block, or else use solid. Explicitly specifying a solid rendertype here is preferable as it averts a map lookup.

public record SimpleModel(net.minecraft.resources.ResourceLocation parent, Map<String,net.minecraft.resources.ResourceLocation> textures, Optional<net.minecraft.resources.ResourceLocation> renderType) extends Record
Represents a parented model file. The codec can be used for datagen via `addDataProvider(GatherDataEvent, String, DynamicOps, Map)`.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`SimpleModel.RenderTypes`
Vanilla render types used by the chunk mesh baker (as of forge 41.0.64 only these are supported in baked block models)

## Field Summary

Fields
Modifier and Type
Field
Description
`static final com.mojang.serialization.Codec<SimpleModel>`
`CODEC`
codec

## Constructor Summary

Constructors
Constructor
Description
`SimpleModel(net.minecraft.resources.ResourceLocation parent, Map<String,net.minecraft.resources.ResourceLocation> textures)`
Deprecated, for removal: This API element is subject to removal in a future version.
Use the main constructor or `create(ResourceLocation)`
`SimpleModel(net.minecraft.resources.ResourceLocation parent, Map<String,net.minecraft.resources.ResourceLocation> textures, Optional<net.minecraft.resources.ResourceLocation> renderType)`
Creates an instance of a `SimpleModel` record class.

## Method Summary

Modifier and Type
Method
Description
`static void`
`addDataProvider(net.minecraftforge.data.event.GatherDataEvent event, String modid, com.mojang.serialization.DynamicOps<com.google.gson.JsonElement> dynamicOps, Map<net.minecraft.resources.ResourceLocation,SimpleModel> entries)`
Creates a DataProvider and adds the provided GatherDataEvent's datagenerator, generating in the assets/namespace/models/ folder
`SimpleModel`
`addTexture(String textureName, net.minecraft.resources.ResourceLocation textureId)`
Chaining method for building a SimpleModel.
`static SimpleModel`
`create(net.minecraft.resources.ResourceLocation parent)`
Creates a SimpleModel with specified parent and solid render type.
`static SimpleModel`
`create(net.minecraft.resources.ResourceLocation parent, net.minecraft.resources.ResourceLocation renderType)`
Creates a SimpleModel with specified parent and render type.
`static SimpleModel`
`createWithoutRenderType(net.minecraft.resources.ResourceLocation parent)`
Creates a SimpleModel with specified parent and no explicit render type.
`final boolean`
`equals(Object o)`
Indicates whether some other object is "equal to" this one.
`final int`
`hashCode()`
Returns a hash code value for this object.
`net.minecraft.resources.ResourceLocation`
`parent()`
Returns the value of the `parent` record component.
`Optional<net.minecraft.resources.ResourceLocation>`
`renderType()`
Returns the value of the `renderType` record component.
`Map<String,net.minecraft.resources.ResourceLocation>`
`textures()`
Returns the value of the `textures` record component.
`final String`
`toString()`
Returns a string representation of this record class.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### CODEC

public static final com.mojang.serialization.Codec<SimpleModel> CODEC
codec

## Constructor Details

### SimpleModel

@Deprecated(forRemoval=true, since="3.0.0.1") public SimpleModel(net.minecraft.resources.ResourceLocation parent, Map<String,net.minecraft.resources.ResourceLocation> textures)
Deprecated, for removal: This API element is subject to removal in a future version.
Use the main constructor or `create(ResourceLocation)`

Parameters:
  `parent` - ResourceLocation of the parent model
  `textures` - Map of String texture identifiers (specific to this model or its parent) to ResourceLocation ids of textures

### SimpleModel

public SimpleModel(net.minecraft.resources.ResourceLocation parent, Map<String,net.minecraft.resources.ResourceLocation> textures, Optional<net.minecraft.resources.ResourceLocation> renderType)
Creates an instance of a `SimpleModel` record class.

Parameters:
  `parent` - the value for the `parent` record component
  `textures` - the value for the `textures` record component
  `renderType` - the value for the `renderType` record component

## Method Details

### addDataProvider

public static void addDataProvider(net.minecraftforge.data.event.GatherDataEvent event, String modid, com.mojang.serialization.DynamicOps<com.google.gson.JsonElement> dynamicOps, Map<net.minecraft.resources.ResourceLocation,SimpleModel> entries)
Creates a DataProvider and adds the provided GatherDataEvent's datagenerator, generating in the assets/namespace/models/ folder

Parameters:
  `event` - GatherDataEvent containing datagen context
  `modid` - String modid for logging purposes
  `dynamicOps` - DynamicOps to serialize the data to json with, e.g. JsonOps.INSTANCE
  `entries` - Map of ResourceLocation ids to SimpleModels to serialize

### createWithoutRenderType

public static SimpleModel createWithoutRenderType(net.minecraft.resources.ResourceLocation parent)
Creates a SimpleModel with specified parent and no explicit render type. The model will inherit a render type from its parent if it has one, baked block models will use the block rendertype lookup map if no parent has a render type.

Parameters:
  `parent` - Model id of the parent modek, e.g. "minecraft:block/cube_all"
Returns:
  Builder-like model that allows chaining via `addTexture(String, ResourceLocation)`

### create

public static SimpleModel create(net.minecraft.resources.ResourceLocation parent)
Creates a SimpleModel with specified parent and solid render type.

Parameters:
  `parent` - Model id of the parent modek, e.g. "minecraft:block/cube_all"
Returns:
  Builder-like model that allows chaining via `addTexture(String, ResourceLocation)`

### create

public static SimpleModel create(net.minecraft.resources.ResourceLocation parent, net.minecraft.resources.ResourceLocation renderType)
Creates a SimpleModel with specified parent and render type.

Parameters:
  `parent` - Model id of the parent modek, e.g. "minecraft:block/cube_all"
  `renderType` - ResourceLocation
Returns:
  Builder-like model that allows chaining via `addTexture(String, ResourceLocation)`

### addTexture

public SimpleModel addTexture(String textureName, net.minecraft.resources.ResourceLocation textureId)
Chaining method for building a SimpleModel. Call on a SimpleModel created via `create(ResourceLocation)`

Parameters:
  `textureName` - Texture key in the parent model, e.g. "texture" or "down" or "particle"
  `textureId` - e.g. "minecraft:block/cobblestone"
Returns:
  This SimpleModel, or crashes if this was called on a deserialized SimpleModel as the map will not be mutable

### toString

public final String toString()
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.

Specified by:
  `toString` in class `Record`
Returns:
  a string representation of this object

### hashCode

public final int hashCode()
Returns a hash code value for this object. The value is derived from the hash code of each of the record components.

Specified by:
  `hashCode` in class `Record`
Returns:
  a hash code value for this object

### equals

public final boolean equals(Object o)
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with `Objects::equals(Object,Object)`.

Specified by:
  `equals` in class `Record`
Parameters:
  `o` - the object with which to compare
Returns:
  `true` if this object is the same as the `o` argument; `false` otherwise.

### parent

public net.minecraft.resources.ResourceLocation parent()
Returns the value of the `parent` record component.

Returns:
  the value of the `parent` record component

### textures

public Map<String,net.minecraft.resources.ResourceLocation> textures()
Returns the value of the `textures` record component.

Returns:
  the value of the `textures` record component

### renderType

public Optional<net.minecraft.resources.ResourceLocation> renderType()
Returns the value of the `renderType` record component.

Returns:
  the value of the `renderType` record component