-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c2f9ca7
commit 4888f6d
Showing
48 changed files
with
347 additions
and
333 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
src/main/generated/assets/spectrum/blockstates/budding_citrine.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "spectrum:block/budding_citrine" | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/generated/assets/spectrum/blockstates/budding_moonstone.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "spectrum:block/budding_moonstone" | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/generated/assets/spectrum/blockstates/budding_onyx.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "spectrum:block/budding_onyx" | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/generated/assets/spectrum/blockstates/budding_topaz.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "spectrum:block/budding_topaz" | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/generated/assets/spectrum/blockstates/citrine_block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"variants": { | ||
"": [ | ||
{ | ||
"model": "spectrum:block/citrine_block" | ||
}, | ||
{ | ||
"model": "spectrum:block/citrine_block_mirrored" | ||
} | ||
] | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/generated/assets/spectrum/blockstates/moonstone_block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"variants": { | ||
"": [ | ||
{ | ||
"model": "spectrum:block/moonstone_block" | ||
}, | ||
{ | ||
"model": "spectrum:block/moonstone_block_mirrored" | ||
} | ||
] | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/generated/assets/spectrum/blockstates/onyx_block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"variants": { | ||
"": [ | ||
{ | ||
"model": "spectrum:block/onyx_block" | ||
}, | ||
{ | ||
"model": "spectrum:block/onyx_block_mirrored" | ||
} | ||
] | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/generated/assets/spectrum/blockstates/topaz_block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"variants": { | ||
"": [ | ||
{ | ||
"model": "spectrum:block/topaz_block" | ||
}, | ||
{ | ||
"model": "spectrum:block/topaz_block_mirrored" | ||
} | ||
] | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...pectrum/models/block/budding_citrine.json → ...pectrum/models/block/budding_citrine.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ctrum/models/block/budding_moonstone.json → ...ctrum/models/block/budding_moonstone.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/spectrum/models/block/budding_onyx.json → ...s/spectrum/models/block/budding_onyx.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../spectrum/models/block/budding_topaz.json → .../spectrum/models/block/budding_topaz.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../spectrum/models/block/citrine_block.json → .../spectrum/models/block/citrine_block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/generated/assets/spectrum/models/block/citrine_block_mirrored.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "minecraft:block/cube_mirrored_all", | ||
"textures": { | ||
"all": "spectrum:block/citrine_block" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...pectrum/models/block/moonstone_block.json → ...pectrum/models/block/moonstone_block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/generated/assets/spectrum/models/block/moonstone_block_mirrored.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "minecraft:block/cube_mirrored_all", | ||
"textures": { | ||
"all": "spectrum:block/moonstone_block" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ets/spectrum/models/block/onyx_block.json → ...ets/spectrum/models/block/onyx_block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/generated/assets/spectrum/models/block/onyx_block_mirrored.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "minecraft:block/cube_mirrored_all", | ||
"textures": { | ||
"all": "spectrum:block/onyx_block" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ts/spectrum/models/block/topaz_block.json → ...ts/spectrum/models/block/topaz_block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/generated/assets/spectrum/models/block/topaz_block_mirrored.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "minecraft:block/cube_mirrored_all", | ||
"textures": { | ||
"all": "spectrum:block/topaz_block" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
src/main/java/de/dafuqs/spectrum/data/SpectrumModelProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package de.dafuqs.spectrum.data; | ||
|
||
import de.dafuqs.spectrum.registries.*; | ||
import net.fabricmc.fabric.api.datagen.v1.*; | ||
import net.fabricmc.fabric.api.datagen.v1.provider.*; | ||
import net.minecraft.block.*; | ||
import net.minecraft.data.client.*; | ||
import net.minecraft.util.*; | ||
import net.minecraft.util.math.*; | ||
|
||
import static de.dafuqs.spectrum.data.SpectrumDataGenerator.*; | ||
|
||
public class SpectrumModelProvider extends FabricModelProvider { | ||
|
||
public static final DeferredRegistrar.Contextual<BlockStateModelGenerator> BLOCK_STATE_MODEL_REGISTRAR = new DeferredRegistrar.Contextual<>(IS_DATAGEN); | ||
|
||
public SpectrumModelProvider(FabricDataOutput output) { | ||
super(output); | ||
} | ||
|
||
@Override | ||
public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) { | ||
BLOCK_STATE_MODEL_REGISTRAR.flush(blockStateModelGenerator); | ||
} | ||
|
||
@Override | ||
public void generateItemModels(ItemModelGenerator itemModelGenerator) { | ||
SpectrumBlocks.provideItemModels(itemModelGenerator); | ||
SpectrumItems.provideItemModels(itemModelGenerator); | ||
} | ||
|
||
public static void registerSingletonBlockModel(Block block, TexturedModel.Factory factory) { | ||
BLOCK_STATE_MODEL_REGISTRAR.defer(ctx -> ctx.registerSingleton(block, factory)); | ||
} | ||
|
||
public static void registerAxisRotatedBlockModel(Block block, TexturedModel.Factory factory) { | ||
BLOCK_STATE_MODEL_REGISTRAR.defer(ctx -> ctx.registerAxisRotated(block, factory)); | ||
} | ||
|
||
public static void registerDefaultFacingUpBlockModel(Block block, TexturedModel.Factory factory) { | ||
BLOCK_STATE_MODEL_REGISTRAR.defer(ctx -> { | ||
BlockStateVariantMap variants = BlockStateVariantMap.create(FacingBlock.FACING) | ||
.register(Direction.DOWN, BlockStateVariant.create().put(VariantSettings.X, VariantSettings.Rotation.R180)) | ||
.register(Direction.EAST, BlockStateVariant.create().put(VariantSettings.X, VariantSettings.Rotation.R90).put(VariantSettings.Y, VariantSettings.Rotation.R90)) | ||
.register(Direction.NORTH, BlockStateVariant.create().put(VariantSettings.X, VariantSettings.Rotation.R90)) | ||
.register(Direction.SOUTH, BlockStateVariant.create().put(VariantSettings.X, VariantSettings.Rotation.R90).put(VariantSettings.Y, VariantSettings.Rotation.R180)) | ||
.register(Direction.UP, BlockStateVariant.create()) | ||
.register(Direction.WEST, BlockStateVariant.create().put(VariantSettings.X, VariantSettings.Rotation.R90).put(VariantSettings.Y, VariantSettings.Rotation.R270)); | ||
ctx.blockStateCollector.accept(VariantsBlockStateSupplier.create(block, BlockStateVariant.create().put(VariantSettings.MODEL, factory.upload(block, ctx.modelCollector))) | ||
.coordinate(variants)); | ||
}); | ||
} | ||
|
||
public static void registerSimpleMirroredBlockModel(Block block) { | ||
BLOCK_STATE_MODEL_REGISTRAR.defer(ctx -> { | ||
VariantsBlockStateSupplier variants = VariantsBlockStateSupplier.create(block, | ||
BlockStateVariant.create().put(VariantSettings.MODEL, TexturedModel.CUBE_ALL.upload(block, ctx.modelCollector)), | ||
BlockStateVariant.create().put(VariantSettings.MODEL, TexturedModel.CUBE_MIRRORED_ALL.upload(block, ctx.modelCollector)) | ||
); | ||
ctx.blockStateCollector.accept(variants); | ||
}); | ||
} | ||
|
||
public static void registerLogBlockModel(Block block) { | ||
BLOCK_STATE_MODEL_REGISTRAR.defer(ctx -> ctx.registerLog(block).log(block)); | ||
} | ||
|
||
public static void registerWoodBlockModel(Block block, Block logBlock) { | ||
BLOCK_STATE_MODEL_REGISTRAR.defer(ctx -> ctx.registerLog(logBlock).wood(block)); | ||
} | ||
|
||
public static void registerTintableCrossBlockModel(Block block, boolean tinted) { | ||
BLOCK_STATE_MODEL_REGISTRAR.defer(ctx -> | ||
ctx.registerTintableCrossBlockState(block, tinted ? BlockStateModelGenerator.TintType.TINTED : BlockStateModelGenerator.TintType.NOT_TINTED)); | ||
} | ||
|
||
public static void registerPottedPlantBlockModel(FlowerPotBlock block, boolean tinted) { | ||
BLOCK_STATE_MODEL_REGISTRAR.defer(ctx -> { | ||
BlockStateModelGenerator.TintType tintType = tinted ? BlockStateModelGenerator.TintType.TINTED : BlockStateModelGenerator.TintType.NOT_TINTED; | ||
TextureMap textureMap = TextureMap.plant(block.getContent()); | ||
Identifier identifier = tintType.getFlowerPotCrossModel().upload(block, textureMap, ctx.modelCollector); | ||
ctx.blockStateCollector.accept(BlockStateModelGenerator.createSingletonBlockState(block, identifier)); | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.