Skip to content

Commit

Permalink
added appendproperties tag (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiDragon authored May 30, 2024
1 parent f54c095 commit cbd63cf
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tags/faq/appendproperties.ytag
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
type: text

---

When trying to create a block with block state properties you might come across an error like this:
`java.lang.IllegalArgumentException: Cannot set property ... as it does not exist in Block{minecraft:air}`

This happens when you don't (correctly) override the `appendProperties` method in your block class. Overriding this method is necessary to tell minecraft which properties your block has.
It should look something like this:
```java
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(YOUR, PROPERTIES, HERE);
}
```

On older versions (before 1.20.5) the method has to be `public` instead of `protected`.

The error refers to your block as `minecraft:air` because it usually hasn't been registered by the time the error is thrown.
You can usually find which block is having issues by looking for the constructor of it in the stacktrace.

0 comments on commit cbd63cf

Please sign in to comment.