add weeping sky light

also, creative tabs
This commit is contained in:
techno-sam
2025-09-02 09:59:59 +02:00
parent 9ecc05520b
commit dde9adbe14
21 changed files with 215 additions and 10 deletions
@@ -2,9 +2,11 @@
e832366c216102270b75085db7a7169881b853b3 assets/crystalline_sky/blockstates/sky.json
ecc125a24d3e2c86d922352d8449f26a4e06d122 assets/crystalline_sky/blockstates/sky_light.json
03e2eb768bc34fbeaabffbff8ed3a2a3044a6db1 assets/crystalline_sky/blockstates/weeping_sky.json
9b3d01168a1cc29b99cf69fe225ad69b0923c9fe assets/crystalline_sky/blockstates/weeping_sky_light.json
c0168359bc7e3978778cee2d000b21c3889c235c assets/crystalline_sky/items/sky.json
c9ebbcbf9d632aeab6bfab2014d7c225f2b290d9 assets/crystalline_sky/items/sky_light.json
2371c7a720a552589983925a24677fd3d1b649b4 assets/crystalline_sky/items/weeping_sky.json
b14b5a0b951ae24fb4b79df59416163b1303d32e assets/crystalline_sky/items/weeping_sky_light.json
6d1e10716c05150e73b2b9e254091125264a7a3d assets/crystalline_sky/models/block/sky.json
3183aeb9fff78d0c65f1ddd0dfb599420573e281 assets/crystalline_sky/models/block/sky_light_00.json
7eaa4c3d4913e0cb117585204dd1dd9e58402b83 assets/crystalline_sky/models/block/sky_light_01.json
@@ -23,6 +25,7 @@ e2c7bebd9eca446bb06fff866ec4d4996917e7e4 assets/crystalline_sky/models/block/sky
0ac5351c3a01e0f9e76517452918e12770b3b54b assets/crystalline_sky/models/block/sky_light_14.json
a87d8988452529a1f5af5662ad636223fdd98fec assets/crystalline_sky/models/block/sky_light_15.json
14508173fcca14cb42755d47374c94d3eace42ce assets/crystalline_sky/models/block/weeping_sky.json
508ffb97ee711b53767b9d33659596197f69ee20 assets/crystalline_sky/models/block/weeping_sky_light.json
008a0d0a76a34d8f375fa355452a5d0f93f9af3b assets/crystalline_sky/models/item/sky.json
2fedd8aff557d4e559ffa8166b4e5ac78136046d assets/crystalline_sky/models/item/sky_light.json
9f0d9fe5dfb05bbe18177db5c40e600c5b256858 assets/crystalline_sky/models/item/sky_light_00.json
@@ -42,3 +45,4 @@ b8795df31017499b35a5b37a4dfbe555a8242cb0 assets/crystalline_sky/models/item/sky_
58349dc5dedb8016fb0bc958fcd4a9ccde13a1cd assets/crystalline_sky/models/item/sky_light_14.json
d500e56057c0c2f3c948894694e2826f1726fd9e assets/crystalline_sky/models/item/sky_light_15.json
15c0a47d504ddd41bbecd4ac58c0c8ccd0f37943 assets/crystalline_sky/models/item/weeping_sky.json
be0be7e1d7ce1ccabed01ef09c6499a2a7f2b132 assets/crystalline_sky/models/item/weeping_sky_light.json
@@ -0,0 +1,2 @@
// 1.21.8 -999999999-01-01T00:00:00 Crystalline Sky/Tags for minecraft:block
1389c0b812f7a6e4d5dd00edac1dc07beb5f9552 data/crystalline_sky/tags/block/sky_light_emitters.json
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "crystalline_sky:block/weeping_sky_light"
}
}
}
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "crystalline_sky:item/weeping_sky_light"
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "crystalline_sky:item/weeping_sky_light"
}
}
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "crystalline_sky:item/weeping_sky_light"
}
}
@@ -0,0 +1,8 @@
{
"values": [
"crystalline_sky:sky",
"crystalline_sky:sky_light",
"crystalline_sky:weeping_sky",
"crystalline_sky:weeping_sky_light"
]
}
@@ -7,7 +7,7 @@ import io.github.slimeistdev.crystalline_sky.registry.CrystallineItems;
public class ModSetup {
public static void init() {
CrystallineDataComponentTypes.init();
CrystallineBlocks.init();
CrystallineItems.init();
CrystallineBlocks.init();
}
}
@@ -0,0 +1,21 @@
package io.github.slimeistdev.crystalline_sky.content.blocks;
import io.github.slimeistdev.crystalline_sky.registry.CrystallineItems;
import net.minecraft.block.BlockState;
import net.minecraft.block.LightBlock;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
public class SkyLightBlock extends LightBlock {
public SkyLightBlock(Settings settings) {
super(settings);
}
@Override
protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return context.isHolding(CrystallineItems.SKY_LIGHT) ? VoxelShapes.fullCube() : VoxelShapes.empty();
}
}
@@ -0,0 +1,74 @@
package io.github.slimeistdev.crystalline_sky.content.blocks;
import io.github.slimeistdev.crystalline_sky.registry.CrystallineItems;
import net.minecraft.block.*;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.Random;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldView;
import net.minecraft.world.tick.ScheduledTickView;
public class WeepingSkyLightBlock extends Block implements Waterloggable {
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
public WeepingSkyLightBlock(Settings settings) {
super(settings);
setDefaultState(getStateManager().getDefaultState().with(WATERLOGGED, false));
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(WATERLOGGED);
}
@Override
protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return context.isHolding(CrystallineItems.WEEPING_SKY_LIGHT) ? VoxelShapes.fullCube() : VoxelShapes.empty();
}
@Override
protected boolean isTransparent(BlockState state) {
return state.getFluidState().isEmpty();
}
@Override
protected BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.INVISIBLE;
}
@Override
protected float getAmbientOcclusionLightLevel(BlockState state, BlockView world, BlockPos pos) {
return 1.0f;
}
@Override
protected BlockState getStateForNeighborUpdate(
BlockState state,
WorldView world,
ScheduledTickView tickView,
BlockPos pos,
Direction direction,
BlockPos neighborPos,
BlockState neighborState,
Random random
) {
if (state.get(WATERLOGGED)) {
tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
}
return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random);
}
@Override
protected FluidState getFluidState(BlockState state) {
return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state);
}
}
@@ -1,4 +1,4 @@
package io.github.slimeistdev.crystalline_sky.items;
package io.github.slimeistdev.crystalline_sky.content.items;
import io.github.slimeistdev.crystalline_sky.registry.CrystallineDataComponentTypes;
import net.minecraft.block.Block;
@@ -1,4 +1,4 @@
package io.github.slimeistdev.crystalline_sky.items;
package io.github.slimeistdev.crystalline_sky.content.items;
import io.github.slimeistdev.crystalline_sky.infrastructure.client.WeepingSkyDebugRenderer;
import io.github.slimeistdev.crystalline_sky.mixin_ducks.client.DebugRenderer_Duck;
@@ -1,5 +1,6 @@
package io.github.slimeistdev.crystalline_sky.datagen;
import io.github.slimeistdev.crystalline_sky.datagen.providers.CrystallineSkyBlockTagProvider;
import io.github.slimeistdev.crystalline_sky.datagen.providers.CrystallineSkyLootProvider;
import io.github.slimeistdev.crystalline_sky.datagen.providers.CrystallineSkyModelProvider;
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
@@ -12,5 +13,6 @@ public class CrystallineSkyDataGenerator implements DataGeneratorEntrypoint {
pack.addProvider(CrystallineSkyModelProvider::new);
pack.addProvider(CrystallineSkyLootProvider::new);
pack.addProvider(CrystallineSkyBlockTagProvider::new);
}
}
@@ -0,0 +1,26 @@
package io.github.slimeistdev.crystalline_sky.datagen.providers;
import io.github.slimeistdev.crystalline_sky.CrystallineSky;
import io.github.slimeistdev.crystalline_sky.registry.CrystallineBlocks;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.tag.TagKey;
import java.util.concurrent.CompletableFuture;
public class CrystallineSkyBlockTagProvider extends FabricTagProvider.BlockTagProvider {
public CrystallineSkyBlockTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output, registriesFuture);
}
@Override
protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) {
valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, CrystallineSky.id("sky_light_emitters")))
.add(CrystallineBlocks.SKY)
.add(CrystallineBlocks.SKY_LIGHT)
.add(CrystallineBlocks.WEEPING_SKY)
.add(CrystallineBlocks.WEEPING_SKY_LIGHT);
}
}
@@ -30,6 +30,9 @@ public class CrystallineSkyModelProvider extends FabricModelProvider {
registerSkyBlock(gen, CrystallineBlocks.SKY);
registerSkyBlock(gen, CrystallineBlocks.WEEPING_SKY);
registerSkyLightBlock(gen, CrystallineBlocks.SKY_LIGHT, CrystallineItems.SKY_LIGHT);
gen.registerBuiltinWithParticle(CrystallineBlocks.WEEPING_SKY_LIGHT, CrystallineItems.WEEPING_SKY_LIGHT);
gen.registerItemModel(CrystallineItems.WEEPING_SKY_LIGHT);
}
private void registerSkyBlock(BlockStateModelGenerator gen, Block block) {
@@ -25,6 +25,7 @@ public class ClientWorldMixin {
private static void modifyBlockMarkerItems(CallbackInfo ci) {
BLOCK_MARKER_ITEMS = new HashSet<>(BLOCK_MARKER_ITEMS);
BLOCK_MARKER_ITEMS.add(CrystallineItems.SKY_LIGHT);
BLOCK_MARKER_ITEMS.add(CrystallineItems.WEEPING_SKY_LIGHT);
BLOCK_MARKER_ITEMS.add(CrystallineItems.SKY);
BLOCK_MARKER_ITEMS.add(CrystallineItems.WEEPING_SKY);
}
@@ -1,6 +1,8 @@
package io.github.slimeistdev.crystalline_sky.registry;
import io.github.slimeistdev.crystalline_sky.CrystallineSky;
import io.github.slimeistdev.crystalline_sky.content.blocks.SkyLightBlock;
import io.github.slimeistdev.crystalline_sky.content.blocks.WeepingSkyLightBlock;
import net.minecraft.block.*;
import net.minecraft.block.AbstractBlock.Settings;
import net.minecraft.registry.Registries;
@@ -28,7 +30,18 @@ public class CrystallineBlocks {
public static final Block SKY_LIGHT = register(
"sky_light",
LightBlock::new,
SkyLightBlock::new,
AbstractBlock.Settings.create()
.replaceable()
.strength(-1.0F, 3600000.8F)
.mapColor(state -> state.get(Properties.WATERLOGGED) ? MapColor.WATER_BLUE : MapColor.CLEAR)
.dropsNothing()
.nonOpaque()
);
public static final Block WEEPING_SKY_LIGHT = register(
"weeping_sky_light",
WeepingSkyLightBlock::new,
AbstractBlock.Settings.create()
.replaceable()
.strength(-1.0F, 3600000.8F)
@@ -59,6 +72,6 @@ public class CrystallineBlocks {
}
public static boolean isWeepingSky(BlockState state) {
return state.isOf(WEEPING_SKY);
return state.isOf(WEEPING_SKY) || state.isOf(WEEPING_SKY_LIGHT);
}
}
@@ -1,13 +1,17 @@
package io.github.slimeistdev.crystalline_sky.registry;
import io.github.slimeistdev.crystalline_sky.items.WeepingSkyBlockItem;
import io.github.slimeistdev.crystalline_sky.content.blocks.SkyLightBlock;
import io.github.slimeistdev.crystalline_sky.content.items.WeepingSkyBlockItem;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.block.LightBlock;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.BlockStateComponent;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.item.*;
import net.minecraft.util.Rarity;
import java.util.ArrayList;
import java.util.List;
public class CrystallineItems {
public static final Item SKY = Items.register(
CrystallineBlocks.SKY,
@@ -25,5 +29,27 @@ public class CrystallineItems {
.component(DataComponentTypes.BLOCK_STATE, BlockStateComponent.DEFAULT.with(LightBlock.LEVEL_15, 15))
);
public static void init() {}
public static final Item WEEPING_SKY_LIGHT = Items.register(
CrystallineBlocks.WEEPING_SKY_LIGHT,
settings -> settings.rarity(Rarity.EPIC)
);
public static void init() {
ItemGroupEvents.modifyEntriesEvent(ItemGroups.OPERATOR).register(entries -> {
if (!entries.getContext().hasPermissions()) return;
List<ItemStack> stacks = new ArrayList<>();
stacks.add(new ItemStack(SKY));
stacks.add(new ItemStack(WEEPING_SKY));
for (int i = 15; i >= 0; i--) {
stacks.add(SkyLightBlock.addNbtForLevel(new ItemStack(SKY_LIGHT), i));
}
stacks.add(new ItemStack(WEEPING_SKY_LIGHT));
entries.addAfter(Items.LIGHT, stacks);
});
}
}
@@ -2,6 +2,7 @@
"block.crystalline_sky.sky": "Sky",
"block.crystalline_sky.weeping_sky": "Weeping Sky",
"block.crystalline_sky.sky_light": "Sky Light",
"block.crystalline_sky.weeping_sky_light": "Weeping Sky Light",
"crystalline_sky.key.toggle_weeping_sky_debug": "Toggle Weeping Sky Debug",
"crystalline_sky.category.crystalline_sky": "Crystalline Sky",
Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B