Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant launch when registering a block who copy a LOG block settings #3436

Closed
boubouleuh opened this issue Nov 23, 2023 · 2 comments
Closed

Cant launch when registering a block who copy a LOG block settings #3436

boubouleuh opened this issue Nov 23, 2023 · 2 comments
Labels
support Issues closed due to being a support request.

Comments

@boubouleuh
Copy link

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

@haykam821
Copy link
Contributor

haykam821 commented Nov 23, 2023

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.

@modmuss50 modmuss50 added the support Issues closed due to being a support request. label Nov 23, 2023
Copy link

👋 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.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Issues closed due to being a support request.
Projects
None yet
Development

No branches or pull requests

3 participants