Skip to content

Commit

Permalink
README.md: add manual model loading
Browse files Browse the repository at this point in the history
  • Loading branch information
ashpieboop committed Feb 21, 2020
1 parent 8fd70eb commit 732fb98
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Adding the API to your project

```
```groovy
repositories {
maven {
name = "OnyxStudios"
Expand All @@ -28,13 +28,13 @@ Firstly you have to register your MODID as an OBJ Model handler, so that FOML wi

### **Example:**

```
```java
OBJLoader.INSTANCE.registerDomain(MODID);
```

After you register your domain, all you have to do is specify the OBJ model in the blockstate's file as such:

```
```json
{
"variants": {
"": { "model": "testmod:block/test_model.obj" }
Expand Down Expand Up @@ -68,7 +68,7 @@ And that's basically it, your block show now render your OBJ model! **(Note: It

JSON-formatted vanilla item models placed in the `models/item` folder can also specify your OBJ model as its "parent" model, similar to blockstates:

```
```json
{
"parent": "MODID:item/test.obj",
"display": {
Expand Down Expand Up @@ -103,3 +103,18 @@ JSON-formatted vanilla item models placed in the `models/item` folder can also s
And your item should now render the OBJ model with the proper transformations specified in its model file.

So far, only vanilla model transformations are supported by FOML.


### Using obj models in other contexts

First, register your models:
```java
public static final ModelIdenfier MODEL_IDENTIFIER = new ModelIdentifier(new Identifier(MODID, MODEL_PATH), null);
OBJLoader.INSTANCE.registerDomain(MODID);
ManualModelLoaderRegistry.INSTANCE.register(MODEL_IDENTIFIER);
```

Then use it in your renderers:
```java
MinecraftClient.getInstance().getBakedModelManager().getModel(MODEL_IDENTIFIER);
```

0 comments on commit 732fb98

Please sign in to comment.