Cant launch when registering a block who copy a LOG block settings
boubouleuh opened this issue ยท 2 comments
public class ModBlocks {
public static final Block POPLAR_LOG = registerBlock("poplar_log", new Block(FabricBlockSettings.copyOf(Blocks.OAK_LOG))); //HERE THE PROBLEM
private static <T extends BlockEntity> BlockEntityType<T> registerBlockEntity(String name, BlockEntityType<T> blockEntityType) {
return Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(UniTech.MOD_ID, name), blockEntityType);
}
private static Item registerBlockItem(String name, Block block) {
return Registry.register(Registries.ITEM, new Identifier(UniTech.MOD_ID, name),
new BlockItem(block, new FabricItemSettings()));
}
public static void registerModBlocks() {
UniTech.LOGGER.info("Registering ModBlocks for " + UniTech.MOD_ID);
}}
This modblocks class when called with : ModBlocks.registerModBlocks(); in the main class will result of this error :
Caused by: java.lang.IllegalArgumentException: Cannot get property EnumProperty{name=axis, clazz=class net.minecraft.util.math.Direction$Axis, values=[x, y, z]} as it does not exist in Block{minecraft:air} at net.minecraft.state.State.get(State.java:98) at net.minecraft.block.Blocks.method_26118(Blocks.java:71) at net.minecraft.block.AbstractBlock$AbstractBlockState.<init>(AbstractBlock.java:795) at net.minecraft.block.BlockState.<init>(BlockState.java:17) at net.minecraft.state.StateManager.method_28484(StateManager.java:61) at java.base/java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:411) at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) at net.minecraft.state.StateManager.<init>(StateManager.java:59) at net.minecraft.state.StateManager$Builder.build(StateManager.java:157) at net.minecraft.block.Block.<init>(Block.java:183) at net.unitium.block.ModBlocks.<clinit>(ModBlocks.java:31) ... 9 more
It does not happen when copying an other block
This is not a Fabric API issue and should have been posted in discussions instead. Note that #2222 describes the same issue.
When copying the settings of the log block, you copied a map color provider that is based on the log's block state, but the properties accessed by the map color provider do not exist in your block. You must copy the log block's settings to a block with the correct properties or replace the map color provider with one of your own.
๐ We use the issue tracker exclusively for final bug reports and feature requests. However, this issue appears to be better suited for either a discussion thread, or a message on our discord server. Please post your request on one of these, and the conversation can continue there.