From cbd63cff7d020ead1a86e8d82df34725bf4d276e Mon Sep 17 00:00:00 2001 From: Matias Koivikko Date: Thu, 30 May 2024 10:53:30 +0300 Subject: [PATCH] added appendproperties tag (#161) --- tags/faq/appendproperties.ytag | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tags/faq/appendproperties.ytag diff --git a/tags/faq/appendproperties.ytag b/tags/faq/appendproperties.ytag new file mode 100644 index 0000000..53953a2 --- /dev/null +++ b/tags/faq/appendproperties.ytag @@ -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 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.