小修改
Some checks failed
Build / build (push) Failing after 20m55s

This commit is contained in:
叁玖领域 2026-01-23 08:18:53 +08:00
parent a6fe95557f
commit 0a94440168
3 changed files with 67 additions and 7 deletions

View File

@ -33,7 +33,7 @@ mod_name=3944Realms 's Lib Mod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=MIT mod_license=MIT
# The mod version. See https://semver.org/ # The mod version. See https://semver.org/
mod_version=0.1.8 mod_version=0.1.9
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources. # This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html # See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View File

@ -1,6 +1,8 @@
package top.r3944realms.lib39.datagen.provider; package top.r3944realms.lib39.datagen.provider;
import net.minecraft.data.loot.LootTableProvider; import net.minecraft.data.loot.LootTableProvider;
import net.minecraft.data.loot.LootTableSubProvider;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import top.r3944realms.lib39.datagen.provider.subprovider.BlockLootTables; import top.r3944realms.lib39.datagen.provider.subprovider.BlockLootTables;
@ -32,6 +34,18 @@ public class SubProvidersWrapper {
return this; return this;
} }
/**
* Add entry sub providers wrapper.
*
* @param subProvider the sub provider
* @param subParamSet the sub param set
* @return the sub providers wrapper
*/
public SubProvidersWrapper addEntry(LootTableSubProvider subProvider, LootContextParamSet subParamSet) {
entries.add(new LootTableProvider.SubProviderEntry(() -> subProvider, subParamSet));
return this;
}
/** /**
* Add block entry sub providers wrapper. * Add block entry sub providers wrapper.
* *

View File

@ -62,6 +62,28 @@ public class ShapeUtil {
return createRotatedDirectionMap(shape); return createRotatedDirectionMap(shape);
} }
/**
* 创建支持全方向的形状映射包括上下
*
* @param shape 基础形状默认为NORTH方向
* @return 全方向形状映射
*/
public static @NotNull Map<Direction, VoxelShape> createFullDirectionMap(VoxelShape shape) {
EnumMap<Direction, VoxelShape> directionMap = new EnumMap<>(Direction.class);
// 水平方向
directionMap.put(Direction.NORTH, shape);
directionMap.put(Direction.EAST, rotateShape(shape, 90));
directionMap.put(Direction.SOUTH, rotateShape(shape, 180));
directionMap.put(Direction.WEST, rotateShape(shape, 270));
// 垂直方向
directionMap.put(Direction.UP, rotateShapeToUp(shape));
directionMap.put(Direction.DOWN, rotateShapeToDown(shape));
return directionMap;
}
/** /**
* 创建原版双方块的形状映射 * 创建原版双方块的形状映射
* *
@ -100,12 +122,7 @@ public class ShapeUtil {
* @return the voxel shape * @return the voxel shape
*/ */
public static @NotNull VoxelShape rotateVoxelShapeXAxis(@NotNull VoxelShape shape) { public static @NotNull VoxelShape rotateVoxelShapeXAxis(@NotNull VoxelShape shape) {
final List<VoxelShape> generatedShapes = new ArrayList<>(); return rotateShapeToUp(shape);
shape.forAllBoxes((minX, minY, minZ, maxX, maxY, maxZ) -> {
VoxelShape rotated = Shapes.box(minX, 1.0 - maxZ, minY, maxX, 1.0 - minZ, maxY);
generatedShapes.add(rotated);
});
return combineShapes(generatedShapes);
} }
/** /**
@ -140,6 +157,35 @@ public class ShapeUtil {
} }
return result; return result;
} }
/**
* 将形状旋转到向上方向绕X轴-90度
*
* @param shape the shape
* @return the voxel shape
*/
public static @NotNull VoxelShape rotateShapeToUp(@NotNull VoxelShape shape) {
final List<VoxelShape> generatedShapes = new ArrayList<>();
shape.forAllBoxes((minX, minY, minZ, maxX, maxY, maxZ) -> {
VoxelShape rotated = Shapes.box(minX, 1.0 - maxZ, minY, maxX, 1.0 - minZ, maxY);
generatedShapes.add(rotated);
});
return combineShapes(generatedShapes);
}
/**
* 将形状旋转到向下方向绕X轴90度
*
* @param shape the shape
* @return the voxel shape
*/
public static @NotNull VoxelShape rotateShapeToDown(@NotNull VoxelShape shape) {
final List<VoxelShape> generatedShapes = new ArrayList<>();
shape.forAllBoxes((minX, minY, minZ, maxX, maxY, maxZ) -> {
VoxelShape rotated = Shapes.box(minX, minZ, minY, maxX, maxZ, maxY);
generatedShapes.add(rotated);
});
return combineShapes(generatedShapes);
}
// ==================== 形状组合与优化 ==================== // ==================== 形状组合与优化 ====================