Skip to content

Commit

Permalink
fix: customblock and item 2
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolLoong committed Feb 11, 2024
1 parent c0c2183 commit 1be21d3
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@ public static class Builder {
protected Builder(CustomBlock customBlock, Materials materials, BlockCreativeCategory blockCreativeCategory) {
this.identifier = customBlock.getNamespaceId();
this.customBlock = customBlock;
var b = (Block) customBlock;
var components = this.nbt.getCompound("components");

//设置一些与PNX内部对应的方块属性
components.putCompound("minecraft:friction", new CompoundTag()
.putFloat("value", (float) Math.min(0.9, Math.max(0, b.getFrictionFactor()))))
.putFloat("value", (float) Math.min(0.9, Math.max(0, customBlock.getFrictionFactor()))))
.putCompound("minecraft:destructible_by_explosion", new CompoundTag()
.putInt("explosion_resistance", (int) customBlock.getResistance()))
.putCompound("minecraft:light_dampening", new CompoundTag()
Expand All @@ -94,7 +93,7 @@ protected Builder(CustomBlock customBlock, Materials materials, BlockCreativeCat
//设置材质
components.putCompound("minecraft:material_instances", new CompoundTag()
.putCompound("mappings", new CompoundTag())
.putCompound("materials", new CompoundTag()));
.putCompound("materials", materials.toCompoundTag()));

//默认单位立方体方块
components.putCompound("minecraft:unit_cube", new CompoundTag());
Expand Down

0 comments on commit 1be21d3

Please sign in to comment.