Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ Lighten up your builds with unobtrusive light source
- ~~De-separate the particle texture from the block texture in cabinets and others~~
- ~~Make Redstone Jack o'Lanterns to turn off when powered~~
- ~~Make Soul Jack o'Lanterns special in some way (for now particles)~~

- ~~Port to newer MC versions:~~
- ~~1.20.4~~

### High priority:

Expand Down Expand Up @@ -150,7 +151,6 @@ Lighten up your builds with unobtrusive light source
- Fix nether wood block variants burning
- Add Illuminated Cabinet Brightening to the config
- Port to newer MC versions:
- 1.20.4
- 1.21.4


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ public void onInitializeClient() {
BlockRenderLayerMap.INSTANCE.putBlock(floorIlluminatedCabinetBlockVariant, renderLayer);
}

// LED block variants
BlockEntityRendererFactories.register(BlockEntityRegistry.LIGHT_STRIP_BLOCK_ENTITY, LightStripBlockEntityRenderer::new);
if (ModConfig.enableLightStripBrightening && !ModConfig.shimmerDetected) LightStripBlockEntityRenderer.enableBrightening();
// Light Strip variants
if (ModConfig.enableColouredFeatureSetBeta) {
BlockEntityRendererFactories.register(BlockEntityRegistry.LIGHT_STRIP_BLOCK_ENTITY, LightStripBlockEntityRenderer::new);
if (ModConfig.enableLightStripBrightening && !ModConfig.shimmerDetected)
LightStripBlockEntityRenderer.enableBrightening();
}

FabricLoader.getInstance().getModContainer(MOD_ID).ifPresent(container -> {
ResourceManagerHelper.registerBuiltinResourcePack(getId("3d_cabinet"), container, ResourcePackActivationType.NORMAL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class ModBlockTags {

// Jack o'Lanterns
public static final TagKey<Block> JACK_O_LANTERNS = TagKey.of(RegistryKeys.BLOCK, getId("jack_o_lanterns"));
public static final TagKey<Block> COLOURED_JACK_O_LANTERNS = TagKey.of(RegistryKeys.BLOCK, getId("coloured_jack_o_lanterns"));

// Candlesticks
public static final TagKey<Block> CANDLESTICKS = TagKey.of(RegistryKeys.BLOCK, getId("candlesticks"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockSt
if (state.getBlock() != newState.getBlock()) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof CabinetBlockEntity cabinetEntity) {
// Handle item drops and block entity cleanup here
// Handle item drops and block entity clean-up here
DefaultedList<ItemStack> inventory = cabinetEntity.getItems();
for (ItemStack stack : inventory) {
if (!stack.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,58 @@
import java.util.Map;

public class InnerStairs extends OuterStairs {
protected static final Map<Direction, VoxelShape> bottomVoxelShape = getVoxelShapeMapOfY(0.5f);
protected static final Map<Direction, VoxelShape> topVoxelShape = getVoxelShapeMapOfY(0f);
protected static Map<Direction, VoxelShape> getVoxelShapeMapOfY(double y) {
protected static final VoxelShape voxelShapeBottomNorth;
protected static final VoxelShape voxelShapeBottomSouth;
protected static final VoxelShape voxelShapeBottomEast;
protected static final VoxelShape voxelShapeBottomWest;

protected static final VoxelShape voxelShapeTopNorth;
protected static final VoxelShape voxelShapeTopSouth;
protected static final VoxelShape voxelShapeTopEast;
protected static final VoxelShape voxelShapeTopWest;

protected static Map<Direction, VoxelShape> getVoxelShapeMapOfY ( double y){
VoxelShape base = VoxelShapes.cuboid(
0f, 0.5f - y, 0f,
1f, 1f - y, 1f
);
return Map.of(
Direction.NORTH, VoxelShapes.union(
VoxelShapes.cuboid(0.5f, y, 0f, 1f, y+0.5f, 1f),
VoxelShapes.cuboid(0f, y, 0.5f, 0.5f, y+0.5f, 1f)
base,
VoxelShapes.cuboid(0.5f, y, 0f, 1f, y + 0.5f, 1f),
VoxelShapes.cuboid(0f, y, 0.5f, 0.5f, y + 0.5f, 1f)
), // original
Direction.SOUTH, VoxelShapes.union(
VoxelShapes.cuboid(0f, y, 0f, 0.5f, y+0.5f, 1f),
VoxelShapes.cuboid(0.5f, y, 0f, 1f, y+0.5f, 0.5f)
base,
VoxelShapes.cuboid(0f, y, 0f, 0.5f, y + 0.5f, 1f),
VoxelShapes.cuboid(0.5f, y, 0f, 1f, y + 0.5f, 0.5f)
), // reverse original
Direction.EAST, VoxelShapes.union(
VoxelShapes.cuboid(0f, y, 0.5f, 1f, y+0.5f, 1f),
VoxelShapes.cuboid(0f, y, 0f, 0.5f, y+0.5f, 0.5f)
base,
VoxelShapes.cuboid(0f, y, 0.5f, 1f, y + 0.5f, 1f),
VoxelShapes.cuboid(0f, y, 0f, 0.5f, y + 0.5f, 0.5f)
), // swap x <-> z + reverse
Direction.WEST, VoxelShapes.union(
VoxelShapes.cuboid(0f, y, 0f, 1f, y+0.5f, 0.5f),
VoxelShapes.cuboid(0.5f, y, 0.5f, 1f, y+0.5f, 1f)
Direction.WEST, VoxelShapes.union(
base,
VoxelShapes.cuboid(0f, y, 0f, 1f, y + 0.5f, 0.5f),
VoxelShapes.cuboid(0.5f, y, 0.5f, 1f, y + 0.5f, 1f)
) // swap x <-> z
);
}
static {
final Map<Direction, VoxelShape> bottomVoxelShape = getVoxelShapeMapOfY(0.5f);
final Map<Direction, VoxelShape> topVoxelShape = getVoxelShapeMapOfY(0f);

voxelShapeBottomNorth = bottomVoxelShape.get(Direction.NORTH);
voxelShapeBottomSouth = bottomVoxelShape.get(Direction.SOUTH);
voxelShapeBottomEast = bottomVoxelShape.get(Direction.EAST);
voxelShapeBottomWest = bottomVoxelShape.get(Direction.WEST);

voxelShapeTopNorth = topVoxelShape.get(Direction.NORTH);
voxelShapeTopSouth = topVoxelShape.get(Direction.SOUTH);
voxelShapeTopEast = topVoxelShape.get(Direction.EAST);
voxelShapeTopWest = topVoxelShape.get(Direction.WEST);
}

public InnerStairs(Settings settings) {
super(settings);
Expand All @@ -42,8 +72,37 @@ public InnerStairs(Settings settings) {
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
Direction dir = state.get(FACING);
return state.get(Properties.BLOCK_HALF) == BlockHalf.TOP
? topVoxelShape.get(dir)
: bottomVoxelShape.get(dir);
if (state.get(Properties.BLOCK_HALF) == BlockHalf.BOTTOM) {
switch (dir) {
case NORTH -> {
return voxelShapeBottomNorth;
}
case SOUTH -> {
return voxelShapeBottomSouth;
}
case EAST -> {
return voxelShapeBottomEast;
}
case WEST -> {
return voxelShapeBottomWest;
}
}
} else {
switch (dir) {
case NORTH -> {
return voxelShapeTopNorth;
}
case SOUTH -> {
return voxelShapeTopSouth;
}
case EAST -> {
return voxelShapeTopEast;
}
case WEST -> {
return voxelShapeTopWest;
}
}
}
return VoxelShapes.fullCube(); // Fallback, should not happen
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,42 @@
import java.util.Map;

public class OuterStairs extends HorizontalFacingBlock implements Waterloggable {
protected static final Map<Direction, VoxelShape> bottomVoxelShape = getVoxelShapeMapOfY(
VoxelShapes.cuboid(0f, 0f, 0f, 1f, 0.5f, 1.0f),
0.5f
);
protected static final Map<Direction, VoxelShape> topVoxelShape = getVoxelShapeMapOfY(
VoxelShapes.cuboid(0f, 0.5f, 0f, 1f, 1f, 1.0f),
0f
);
protected static Map<Direction, VoxelShape> getVoxelShapeMapOfY(VoxelShape base, double y) {
protected static final VoxelShape voxelShapeBottomNorth;
protected static final VoxelShape voxelShapeBottomSouth;
protected static final VoxelShape voxelShapeBottomEast;
protected static final VoxelShape voxelShapeBottomWest;

protected static final VoxelShape voxelShapeTopNorth;
protected static final VoxelShape voxelShapeTopSouth;
protected static final VoxelShape voxelShapeTopEast;
protected static final VoxelShape voxelShapeTopWest;

protected static Map<Direction, VoxelShape> getVoxelShapeMapOfY(double y) {
VoxelShape base = VoxelShapes.cuboid(
0f, 0.5f - y, 0f,
1f, 1f - y, 1f
);
return Map.of(
Direction.NORTH, VoxelShapes.union(base, VoxelShapes.cuboid(0.5f, y, 0.5f, 1.0f, y+0.5f, 1.0f)), // original
Direction.SOUTH, VoxelShapes.union(base, VoxelShapes.cuboid(0.0f, y, 0.0f, 0.5f, y+0.5f, 0.5f)), // reverse original
Direction.EAST, VoxelShapes.union(base, VoxelShapes.cuboid(0.0f, y, 0.5f, 0.5f, y+0.5f, 1.0f)), // swap x <-> z + reverse
Direction.WEST, VoxelShapes.union(base, VoxelShapes.cuboid(0.5f, y, 0.0f, 1.0f, y+0.5f, 0.5f)) // swap x <-> z
);
}
static {
final Map<Direction, VoxelShape> bottomVoxelShape = getVoxelShapeMapOfY(0.5f);
final Map<Direction, VoxelShape> topVoxelShape = getVoxelShapeMapOfY(0f);

voxelShapeBottomNorth = bottomVoxelShape.get(Direction.NORTH);
voxelShapeBottomSouth = bottomVoxelShape.get(Direction.SOUTH);
voxelShapeBottomEast = bottomVoxelShape.get(Direction.EAST);
voxelShapeBottomWest = bottomVoxelShape.get(Direction.WEST);

voxelShapeTopNorth = topVoxelShape.get(Direction.NORTH);
voxelShapeTopSouth = topVoxelShape.get(Direction.SOUTH);
voxelShapeTopEast = topVoxelShape.get(Direction.EAST);
voxelShapeTopWest = topVoxelShape.get(Direction.WEST);
}

public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;

Expand Down Expand Up @@ -69,8 +89,29 @@ public FluidState getFluidState(BlockState state) {
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
Direction dir = state.get(FACING);
return state.get(Properties.BLOCK_HALF) == BlockHalf.TOP
? topVoxelShape.get(dir)
: bottomVoxelShape.get(dir);
if (state.get(Properties.BLOCK_HALF) == BlockHalf.BOTTOM) {
switch (dir) {
case NORTH:
return voxelShapeBottomNorth;
case SOUTH:
return voxelShapeBottomSouth;
case EAST:
return voxelShapeBottomEast;
case WEST:
return voxelShapeBottomWest;
}
} else {
switch (dir) {
case NORTH:
return voxelShapeTopNorth;
case SOUTH:
return voxelShapeTopSouth;
case EAST:
return voxelShapeTopEast;
case WEST:
return voxelShapeTopWest;
}
}
return VoxelShapes.fullCube(); // Fallback, should not happen
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.mikip98.humilityafm.content.ModBlockTags;
import io.github.mikip98.humilityafm.generators.CabinetBlockGenerator;
import io.github.mikip98.humilityafm.generators.CandlestickGenerator;
import io.github.mikip98.humilityafm.generators.TerracottaTilesGenerator;
import io.github.mikip98.humilityafm.generators.WoodenMosaicGenerator;
import io.github.mikip98.humilityafm.registries.BlockRegistry;
Expand All @@ -28,26 +29,26 @@ protected void configure(RegistryWrapper.WrapperLookup arg) {
// ------------ Custom Tags ------------
// Cabinet Block Tags
getOrCreateTagBuilder(ModBlockTags.CABINET_BLOCKS)
.add(getIds(Arrays.stream(CabinetBlockGenerator.cabinetBlockVariantsNames).map(s -> "cabinet_block_" + s)))
.add(CabinetBlockGenerator.cabinetBlockVariants)
.add(BlockRegistry.CABINET_BLOCK); // Manual testing block
getOrCreateTagBuilder(ModBlockTags.ILLUMINATED_CABINET_BLOCKS)
.add(getIds(Arrays.stream(CabinetBlockGenerator.cabinetBlockVariantsNames).map(s -> "illuminated_cabinet_block_" + s)))
.add(CabinetBlockGenerator.illuminatedCabinetBlockVariants)
.add(BlockRegistry.ILLUMINATED_CABINET_BLOCK); // Manual testing block
getOrCreateTagBuilder(ModBlockTags.CABINET_BLOCKS)
.add(getIds(Arrays.stream(CabinetBlockGenerator.cabinetBlockVariantsNames).map(s -> "floor_cabinet_block_" + s)))
.add(CabinetBlockGenerator.floorCabinetBlockVariants)
.add(BlockRegistry.FLOOR_CABINET_BLOCK); // Manual testing block
getOrCreateTagBuilder(ModBlockTags.ILLUMINATED_CABINET_BLOCKS)
.add(getIds(Arrays.stream(CabinetBlockGenerator.cabinetBlockVariantsNames).map(s -> "floor_illuminated_cabinet_block_" + s)))
.add(CabinetBlockGenerator.floorIlluminatedCabinetBlockVariants)
.add(BlockRegistry.FLOOR_ILLUMINATED_CABINET_BLOCK); // Manual testing block

// Wooden Mosaic Block Tag
getOrCreateTagBuilder(ModBlockTags.WOODEN_MOSAIC_BLOCKS)
.add(getIds(Arrays.stream(WoodenMosaicGenerator.woodenMosaicVariantsNames).map(s -> "wooden_mosaic_" + s)))
.add(WoodenMosaicGenerator.woodenMosaicVariants)
.add(BlockRegistry.WOODEN_MOSAIC); // Manual testing block

// Terracotta Tiles Block Tag
getOrCreateTagBuilder(ModBlockTags.TERRACOTTA_TILES_BLOCKS)
.add(getIds(Arrays.stream(TerracottaTilesGenerator.terracottaTilesVariantsNames).map(s -> "terracotta_tiles_" + s)));
.add(TerracottaTilesGenerator.terracottaTilesVariants);

// Inner & Outer Stairs Block Tags
String[] woodenVariants = GenerationData.vanillaWoodTypes;
Expand All @@ -69,15 +70,19 @@ protected void configure(RegistryWrapper.WrapperLookup arg) {

// Jack o'Lanterns
getOrCreateTagBuilder(ModBlockTags.JACK_O_LANTERNS)
.add(getId("jack_o_lantern_redstone"))
.add(getId("jack_o_lantern_soul"));
.add(BlockRegistry.JACK_O_LANTERN_SOUL)
.add(BlockRegistry.JACK_O_LANTERN_REDSTONE);
getOrCreateTagBuilder(ModBlockTags.COLOURED_JACK_O_LANTERNS)
.add(BlockRegistry.COLOURED_WEAK_JACK_O_LANTERNS)
.add(BlockRegistry.COLOURED_WEAK_JACK_O_LANTERNS)
.add(BlockRegistry.COLOURED_STRONG_JACK_O_LANTERNS);

// Candlesticks
FabricTagProvider<Block>.FabricTagBuilder tag = getOrCreateTagBuilder(ModBlockTags.CANDLESTICKS)
.add(getIds(Arrays.stream(GenerationData.vanillaCandlestickMetals).map(s -> "candlestick_" + s)))
.add(getIds(Arrays.stream(GenerationData.vanillaCandlestickMetals).map(s -> "candlestick_wall_" + s)));
GenerationData.vanillaRustableCandlestickMetals.forEach(metals -> tag.add(getIds(Arrays.stream(metals).map(s -> "candlestick_" + s))));
GenerationData.vanillaRustableCandlestickMetals.forEach(metals -> tag.add(getIds(Arrays.stream(metals).map(s -> "candlestick_wall_" + s))));
.add(CandlestickGenerator.candlestickClassicStandingVariants)
.add(CandlestickGenerator.candlestickClassicWallVariants);
CandlestickGenerator.candlestickRustableStandingVariants.forEach(tag::add);
CandlestickGenerator.candlestickRustableWallVariants.forEach(tag::add);


// ------------ Vanilla Tags ------------
Expand All @@ -94,7 +99,8 @@ protected void configure(RegistryWrapper.WrapperLookup arg) {
.addTag(ModBlockTags.WOODEN_INNER_STAIRS)
.addTag(ModBlockTags.WOODEN_OUTER_STAIRS)
// Jack o'Lanterns
.addTag(ModBlockTags.JACK_O_LANTERNS);
.addTag(ModBlockTags.JACK_O_LANTERNS)
.addOptionalTag(ModBlockTags.COLOURED_JACK_O_LANTERNS);
// Pickaxe Mineable
getOrCreateTagBuilder(ModBlockTags.PICKAXE_MINEABLE)
// Terracotta Tiles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ public class BlockRegistry {
// Jack o'Lanterns
public static final Block JACK_O_LANTERN_REDSTONE = new JackOLanternRedStone();
public static final Block JACK_O_LANTERN_SOUL = new JackOLanternSoul();
public static final Block[] COLOURED_WEAK_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "jack_o_lantern_" + s + "_weak")).toArray(Block[]::new);
public static final Block[] COLOURED_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "jack_o_lantern_" + s)).toArray(Block[]::new);
public static final Block[] COLOURED_STRONG_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "jack_o_lantern_" + s + "_strong")).toArray(Block[]::new);
public static Block[] COLOURED_WEAK_JACK_O_LANTERNS;
public static Block[] COLOURED_JACK_O_LANTERNS;
public static Block[] COLOURED_STRONG_JACK_O_LANTERNS;


public static void register() {
Expand Down Expand Up @@ -146,6 +146,12 @@ public static void register() {
"light_strip_"
);
putIntoItemGroup(ColouredFeatureSetGenerator.LightStripBlockVariants, ItemGroups.COLORED_BLOCKS);

// Register coloured Jack o'Lanterns
COLOURED_WEAK_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "coloured_weak_jack_o_lantern_" + s)).toArray(Block[]::new);
COLOURED_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "coloured_jack_o_lantern_" + s)).toArray(Block[]::new);
COLOURED_STRONG_JACK_O_LANTERNS = Arrays.stream(GenerationData.vanillaColorPallet).map(s -> registerWithItem(new JackOLantern(), "coloured_strong_jack_o_lantern_" + s)).toArray(Block[]::new);

}

// Register Forced corner stairs
Expand Down