Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,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 @@ -18,22 +18,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 @@ -77,8 +97,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,19 +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(getIds(Arrays.stream(GenerationData.vanillaColorPallet).map(s -> "coloured_weak_jack_o_lantern_" + s + "_weak")))
.add(getIds(Arrays.stream(GenerationData.vanillaColorPallet).map(s -> "coloured_weak_jack_o_lantern_" + s)))
.add(getIds(Arrays.stream(GenerationData.vanillaColorPallet).map(s -> "coloured_weak_jack_o_lantern_" + s + "_strong")));
.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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ public static void register() {
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_jack_o_lantern_" + s + "_weak")).toArray(Block[]::new);
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_jack_o_lantern_" + s + "_strong")).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);

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.mikip98.humilityafm.registries;

import io.github.mikip98.humilityafm.config.ModConfig;
import io.github.mikip98.humilityafm.content.items.DoubleVerticallyAttachableBlockItem;
import io.github.mikip98.humilityafm.util.GenerationData;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
Expand Down Expand Up @@ -36,11 +37,15 @@ public class ItemRegistry {


public static void register() {
putIntoItemGroup(GLOWING_POWDER_VARIANTS, ItemGroups.INGREDIENTS);
putIntoItemGroup(CABINET_ITEM_VARIANTS, ItemGroups.COLORED_BLOCKS);
putIntoItemGroup(ILLUMINATED_CABINET_ITEM_VARIANTS, ItemGroups.COLORED_BLOCKS);
putIntoItemGroup(CANDLESTICK_ITEM_VARIANTS, ItemGroups.FUNCTIONAL);
RUSTABLE_CANDLESTICK_ITEM_VARIANTS.forEach(s -> putIntoItemGroup(s, ItemGroups.FUNCTIONAL));
if (ModConfig.enableCandlestickBeta) {
putIntoItemGroup(CANDLESTICK_ITEM_VARIANTS, ItemGroups.FUNCTIONAL);
RUSTABLE_CANDLESTICK_ITEM_VARIANTS.forEach(s -> putIntoItemGroup(s, ItemGroups.FUNCTIONAL));
}
if (ModConfig.enableColouredFeatureSetBeta) {
putIntoItemGroup(GLOWING_POWDER_VARIANTS, ItemGroups.INGREDIENTS);
}
}


Expand Down
Loading