Add codecs for generated directional blocks
Some checks failed
Build / build (push) Successful in 12m40s
Release Dry Run / release-dry-run (push) Successful in 4s
Codex Template Compliance / template-compliance (push) Successful in 5s
Scheduled Security Scan / security-scan (push) Failing after 6s
Scheduled Repository Cleanup Check / cleanup-check (push) Successful in 7s
Scheduled Dependency Check / dependency-check (push) Successful in 5s
Some checks failed
Build / build (push) Successful in 12m40s
Release Dry Run / release-dry-run (push) Successful in 4s
Codex Template Compliance / template-compliance (push) Successful in 5s
Scheduled Security Scan / security-scan (push) Failing after 6s
Scheduled Repository Cleanup Check / cleanup-check (push) Successful in 7s
Scheduled Dependency Check / dependency-check (push) Successful in 5s
This commit is contained in:
@@ -114,6 +114,7 @@ def write_generated_registries(blocks: list[str], block_kinds: dict[str, str], i
|
||||
lines: list[str] = [
|
||||
"package net.mcreator.crustychunks.init;",
|
||||
"",
|
||||
"import com.mojang.serialization.MapCodec;",
|
||||
"import net.mcreator.crustychunks.CrustyChunksMod;",
|
||||
"import net.minecraft.core.Direction;",
|
||||
"import net.minecraft.core.registries.Registries;",
|
||||
@@ -191,12 +192,19 @@ def write_generated_registries(blocks: list[str], block_kinds: dict[str, str], i
|
||||
" }",
|
||||
"",
|
||||
" private static final class GeneratedHorizontalBlock extends HorizontalDirectionalBlock {",
|
||||
" private static final MapCodec<GeneratedHorizontalBlock> CODEC = simpleCodec(GeneratedHorizontalBlock::new);",
|
||||
"",
|
||||
" private GeneratedHorizontalBlock(BlockBehaviour.Properties properties) {",
|
||||
" super(properties);",
|
||||
" registerDefaultState(stateDefinition.any().setValue(FACING, Direction.NORTH));",
|
||||
" }",
|
||||
"",
|
||||
" @Override",
|
||||
" protected MapCodec<? extends GeneratedHorizontalBlock> codec() {",
|
||||
" return CODEC;",
|
||||
" }",
|
||||
"",
|
||||
" @Override",
|
||||
" public BlockState getStateForPlacement(BlockPlaceContext context) {",
|
||||
" return defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite());",
|
||||
" }",
|
||||
@@ -208,12 +216,19 @@ def write_generated_registries(blocks: list[str], block_kinds: dict[str, str], i
|
||||
" }",
|
||||
"",
|
||||
" private static final class GeneratedFaceAttachedHorizontalBlock extends FaceAttachedHorizontalDirectionalBlock {",
|
||||
" private static final MapCodec<GeneratedFaceAttachedHorizontalBlock> CODEC = simpleCodec(GeneratedFaceAttachedHorizontalBlock::new);",
|
||||
"",
|
||||
" private GeneratedFaceAttachedHorizontalBlock(BlockBehaviour.Properties properties) {",
|
||||
" super(properties);",
|
||||
" registerDefaultState(stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(FACE, AttachFace.FLOOR));",
|
||||
" }",
|
||||
"",
|
||||
" @Override",
|
||||
" protected MapCodec<? extends GeneratedFaceAttachedHorizontalBlock> codec() {",
|
||||
" return CODEC;",
|
||||
" }",
|
||||
"",
|
||||
" @Override",
|
||||
" protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {",
|
||||
" builder.add(FACING, FACE);",
|
||||
" }",
|
||||
|
||||
Reference in New Issue
Block a user