mirror of
https://github.com/wisplite/crystalline-sky.git
synced 2026-10-30 13:32:18 -05:00
add weeping sky light
also, creative tabs
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
+74
@@ -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
-1
@@ -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
-1
@@ -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;
|
||||
+2
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+26
@@ -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);
|
||||
}
|
||||
}
|
||||
+3
@@ -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);
|
||||
}
|
||||
|
||||
+15
-2
@@ -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 |
Reference in New Issue
Block a user