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

Add Cardinally orientable blocks and shuffle asset generation code #459

Merged
merged 9 commits into from
Sep 27, 2022

Conversation

ChiefArug
Copy link
Contributor

onEvent('block.registry', event => {
	event.create('test_block', 'cardinal')
		.texture('side', 'minecraft:block/furnace_top')
		.texture('front', 'minecraft:block/iron_block')
})

This also shuffles asset generation around sot it is now in five different methods.
generateAssetJsons no longer directly generates the assets. Instead it passes that on to generateBlockStateJson, generateBlockModelJsons and generateItemModelJson. This makes it so that subclasses only need to override the necessary methods.
The fifth method is generateMultipartBlockstateJson in MultipartShapedBlockBuilder, which should be used for blocks such as fences and walls that use multipart blockstates.
All KubeJS block builders now use this system, meaning that ones that used to remove the checks for the user overriding a model/blockstate json should no longer do that.
This should also not break addons that still override generateAssetJsons.

@ChiefArug
Copy link
Contributor Author

I can also port this to 1.19 if wanted, although i know the 6.0 rewrite is coming so that may need to wait

@ChiefArug
Copy link
Contributor Author

I have just realized a flaw in this, the Block object returned does not extend BasicBlockJS, so behaviours like random ticking and waterlogging do not function properly.
The solution is probably going to be reimplementing the facing blockstate on an extension of BasicBlockJS, instead of HorizontalDirectionalBlock.

@ChiefArug
Copy link
Contributor Author

Another potential problem: the hitbox does not rotate when the state changes. Should be an easy enough fix

@ChiefArug ChiefArug changed the base branch from 1.18/dev to 1.19/dev September 5, 2022 07:28
@ChiefArug
Copy link
Contributor Author

This should be ready to merge now.

@LatvianModder LatvianModder merged commit 43bfb90 into KubeJS-Mods:1.19/dev Sep 27, 2022
@ChiefArug ChiefArug deleted the orientableBlocks branch October 10, 2022 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants