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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ jobs:
if-no-files-found: error
retention-days: 30
path: |
build/libs/SkysBuildingPieces-0.3.11.2602001.jar
build/libs/SkysBuildingPieces-0.3.11.2602001-sources.jar
build/libs/SkysBuildingPieces-0.3.11.2602001-javadoc.jar
build/libs/SkysBuildingPieces-0.3.12.2602001.jar
build/libs/SkysBuildingPieces-0.3.12.2602001-sources.jar
build/libs/SkysBuildingPieces-0.3.12.2602001-javadoc.jar
build/release/SHA256SUMS
CHANGELOG.md

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.3.12.2602001

- Add matching pieces for podzol, mycelium, rooted dirt, mud, clay, blue ice and several natural cave rocks.

## 0.3.11.2602001

- Leave unrelated storage inventories alone during legacy recovery.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ release_enabled=true
curseforge_project_id=1754162
mod_name=Sky's Building Pieces
mod_license=LGPL-2.1-only
mod_version=0.3.11.2602001
mod_version=0.3.12.2602001
mod_group=zone.moddev.mc.skysbuildingpieces
mod_authors=SkyBlade1978
mod_description=Extra building shapes for vanilla materials, with built-in Mineralogy support when installed. No world generation.
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,20 @@ private static void slabPlacement(ServerLevel world, BlockPos position, ServerPl

// Exercise this registered Sky item directly. Drops and recipes may reuse a native
// slab, whose placement belongs to BuildingBricks while that mod is installed.
ItemStack stack = ownSlab(block, block.palette.materials.get(slot));
String material = block.palette.materials.get(slot);
if (Pieces.state(material, Shape.VERTICAL_SLAB, 0) == null) {
expected = face == Direction.DOWN || face.getAxis().isHorizontal() && hitY > .5f
? Direction.UP : Direction.DOWN;
}
ItemStack stack = ownSlab(block, material);

require(use(stack, player, world, anchor, InteractionHand.MAIN_HAND, face, hitX, hitY,
hitZ) == InteractionResult.SUCCESS,
"slab face/edge placement " + face + " " + click);
require(world.getBlockState(position)
.equals(Pieces.state(block.palette.materials.get(slot), slabShape(expected),
slabOrientation(expected))),
"slab selects correct half " + face + " " + click);
"slab selects correct half " + material + " " + face + " " + click);
require(stack.getCount() == 1 && world.getBlockState(anchor).getBlock() == Blocks.STONE,
"one item consumed; supporting block intact");
checked++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public Catalogue() {
Module core = registerModule("vanilla", "skysbuildingpieces", read(Catalogue.class, ROOT + "materials.json"),
read(Catalogue.class, ROOT + "palettes.json"), 255);

if (core.palettes.size() != 237 || core.palettes.size() + 1 > 256) {
if (core.palettes.size() != 251 || core.palettes.size() + 1 > 256) {
throw new IllegalStateException("Core block budget exceeded");
}
}
Expand Down Expand Up @@ -115,8 +115,18 @@ public synchronized void freeze() {
}

public static boolean supportsShape(MaterialDef definition, Shape shape) {
return !definition.soil() || !(shape == Shape.SLAB || shape == Shape.VERTICAL_SLAB)
|| shape == Shape.VERTICAL_SLAB && definition.id.equals("minecraft:dirt");
if (!definition.soil()) {
return true;
}
return switch (shape) {
case SLAB -> switch (definition.id) {
case "minecraft:dirt_podzol", "minecraft:dirt_mycelium", "minecraft:rooted_dirt", "minecraft:mud",
"minecraft:clay", "biomesoplenty:origin_grass_block" -> true;
default -> false;
};
case VERTICAL_SLAB -> definition.id.equals("minecraft:dirt");
default -> true;
};
}

public String moduleFor(String material) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ static InteractionResult place(ItemStack stack, Player player, Level world, Bloc
return InteractionResult.FAIL;
}

boolean directionalSlabs = BuildingPiecesConfig.directionalSlabPlacement()
&& (shape == Shape.VERTICAL_SLAB
|| shape == Shape.SLAB && Pieces.state(materialId, Shape.VERTICAL_SLAB, 0) != null);
float targetX = hitX;
float targetY = hitY;
float targetZ = hitZ;
Expand All @@ -126,7 +129,7 @@ static InteractionResult place(ItemStack stack, Player player, Level world, Bloc

// Vanilla slabs call a matching half replaceable. Join it before asking the placement context whether this cell
// can accept a new block.
if (combine(world, position, existingState, materialId, shape, player, stack, face, hitX, hitY, hitZ)) {
if (combine(world, position, existingState, materialId, shape, player, stack, face, hitX, hitY, hitZ, directionalSlabs)) {
return InteractionResult.SUCCESS;
}
if (!replaceable(world, position, player, hand, stack, face, hitX, hitY, hitZ)) {
Expand All @@ -137,7 +140,7 @@ static InteractionResult place(ItemStack stack, Player player, Level world, Bloc
targetZ -= face.getStepZ();

if (combine(world, position, existingState, materialId, shape, player, stack, face, targetX, targetY,
targetZ)) {
targetZ, directionalSlabs)) {
return InteractionResult.SUCCESS;
}
}
Expand All @@ -152,7 +155,7 @@ static InteractionResult place(ItemStack stack, Player player, Level world, Bloc

switch (shape) {
case SLAB:
Direction slabSide = BuildingPiecesConfig.directionalSlabPlacement()
Direction slabSide = directionalSlabs
? SlabPlacement.side(face, hitX, hitY, hitZ) : SlabPlacement.horizontalSide(face, hitY);
placedShape = SlabPlacement.shape(slabSide);
orientation = SlabPlacement.orientation(slabSide);
Expand Down Expand Up @@ -217,7 +220,8 @@ public boolean canPlaceBlockOnSide(Level world, BlockPos position, Direction sid

/** Combine occupied cells only when their union is a supported shape of the same material. */
private static boolean combine(Level world, BlockPos position, BlockState existingState, String material,
Shape shape, Player player, ItemStack stack, Direction face, float hitX, float hitY, float hitZ) {
Shape shape, Player player, ItemStack stack, Direction face, float hitX, float hitY, float hitZ,
boolean directionalSlabs) {
if (!player.mayUseItemAt(position, face, stack) || shape == Shape.WALL || shape == Shape.PANE) {
return false;
}
Expand Down Expand Up @@ -254,7 +258,6 @@ private static boolean combine(Level world, BlockPos position, BlockState existi
| (hitY + face.getStepY() * epsilon >= .5f ? 4 : 0);
BlockState combinedState = null;
boolean isSlab = shape == Shape.SLAB || shape == Shape.VERTICAL_SLAB;
boolean directionalSlabs = isSlab && BuildingPiecesConfig.directionalSlabPlacement();
if (isSlab && !directionalSlabs && Geometry.orientationFor(shape, existingCells) < 0) {
return false;
}
Expand Down
3,206 changes: 3,205 additions & 1 deletion src/main/recipe-book/native-1.14-generated.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"variants": {
"orientation=top_north_west,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_corner_0"
},
"orientation=top_north_west,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_corner_0"
},
"orientation=top_north_east,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_corner_1"
},
"orientation=top_north_east,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_corner_1"
},
"orientation=top_south_east,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_corner_2"
},
"orientation=top_south_east,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_corner_2"
},
"orientation=top_south_west,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_corner_3"
},
"orientation=top_south_west,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_corner_3"
},
"orientation=bottom_north_west,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_corner_4"
},
"orientation=bottom_north_west,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_corner_4"
},
"orientation=bottom_north_east,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_corner_5"
},
"orientation=bottom_north_east,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_corner_5"
},
"orientation=bottom_south_east,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_corner_6"
},
"orientation=bottom_south_east,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_corner_6"
},
"orientation=bottom_south_west,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_corner_7"
},
"orientation=bottom_south_west,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_corner_7"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"variants": {
"orientation=top_north,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_horizontal_step_0"
},
"orientation=top_north,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_horizontal_step_0"
},
"orientation=top_east,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_horizontal_step_1"
},
"orientation=top_east,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_horizontal_step_1"
},
"orientation=top_south,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_horizontal_step_2"
},
"orientation=top_south,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_horizontal_step_2"
},
"orientation=top_west,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_horizontal_step_3"
},
"orientation=top_west,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_horizontal_step_3"
},
"orientation=bottom_north,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_horizontal_step_4"
},
"orientation=bottom_north,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_horizontal_step_4"
},
"orientation=bottom_east,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_horizontal_step_5"
},
"orientation=bottom_east,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_horizontal_step_5"
},
"orientation=bottom_south,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_horizontal_step_6"
},
"orientation=bottom_south,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_horizontal_step_6"
},
"orientation=bottom_west,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_horizontal_step_7"
},
"orientation=bottom_west,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_horizontal_step_7"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"variants": {
"orientation=top,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_slab_0"
},
"orientation=top,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_slab_0"
},
"orientation=bottom,waterlogged=false": {
"model": "skysbuildingpieces:block/blue_ice_slab_1"
},
"orientation=bottom,waterlogged=true": {
"model": "skysbuildingpieces:block/blue_ice_slab_1"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"variants": {
"orientation=top_north_west,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_corner_0"
},
"orientation=top_north_west,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_corner_0"
},
"orientation=top_north_east,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_corner_1"
},
"orientation=top_north_east,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_corner_1"
},
"orientation=top_south_east,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_corner_2"
},
"orientation=top_south_east,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_corner_2"
},
"orientation=top_south_west,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_corner_3"
},
"orientation=top_south_west,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_corner_3"
},
"orientation=bottom_north_west,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_corner_4"
},
"orientation=bottom_north_west,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_corner_4"
},
"orientation=bottom_north_east,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_corner_5"
},
"orientation=bottom_north_east,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_corner_5"
},
"orientation=bottom_south_east,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_corner_6"
},
"orientation=bottom_south_east,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_corner_6"
},
"orientation=bottom_south_west,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_corner_7"
},
"orientation=bottom_south_west,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_corner_7"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"variants": {
"orientation=top_north,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_horizontal_step_0"
},
"orientation=top_north,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_horizontal_step_0"
},
"orientation=top_east,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_horizontal_step_1"
},
"orientation=top_east,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_horizontal_step_1"
},
"orientation=top_south,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_horizontal_step_2"
},
"orientation=top_south,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_horizontal_step_2"
},
"orientation=top_west,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_horizontal_step_3"
},
"orientation=top_west,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_horizontal_step_3"
},
"orientation=bottom_north,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_horizontal_step_4"
},
"orientation=bottom_north,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_horizontal_step_4"
},
"orientation=bottom_east,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_horizontal_step_5"
},
"orientation=bottom_east,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_horizontal_step_5"
},
"orientation=bottom_south,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_horizontal_step_6"
},
"orientation=bottom_south,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_horizontal_step_6"
},
"orientation=bottom_west,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_horizontal_step_7"
},
"orientation=bottom_west,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_horizontal_step_7"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"variants": {
"orientation=top,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_slab_0"
},
"orientation=top,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_slab_0"
},
"orientation=bottom,waterlogged=false": {
"model": "skysbuildingpieces:block/calcite_slab_1"
},
"orientation=bottom,waterlogged=true": {
"model": "skysbuildingpieces:block/calcite_slab_1"
}
}
}
Loading
Loading