Skip to content

Commit 3ffb421

Browse files
committed
Fixup Bamboo Placement
1 parent dc28dc2 commit 3ffb421

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

blocks/src/main/java/net/minestom/vanilla/blocks/placement/BambooPlantPlacementRule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class BambooPlantPlacementRule extends BlockPlacementRule {
2626

2727
public BambooPlantPlacementRule(Block block) {
2828
super(block);
29-
this.plantableOn = TagHelper.getInstance().getTaggedWith("minecraft:bamboo_plantable_on");
29+
this.plantableOn = TagHelper.getInstance().getHashed("#bamboo_plantable_on");
3030
this.bamboo = Set.of(
3131
Block.BAMBOO,
3232
Block.BAMBOO_SAPLING

blocks/src/main/java/net/minestom/vanilla/common/utils/TagHelper.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import net.minestom.server.instance.block.Block;
1010
import net.minestom.server.registry.Registry;
1111
import net.minestom.server.registry.RegistryTag;
12+
import net.minestom.server.registry.TagKey;
1213
import org.jetbrains.annotations.NotNull;
1314

1415
public class TagHelper {
@@ -30,6 +31,16 @@ public boolean hasTag(Block element, String tag) {
3031
return data.contains(element);
3132
}
3233

34+
public Set<Block> getHashed(String tag) {
35+
RegistryTag<Block> data = staticRegistry.getTag(TagKey.ofHash(tag));
36+
if (data == null) return new HashSet<>();
37+
38+
return StreamSupport.stream(data.spliterator(), false)
39+
.map(obj -> Block.fromKey(obj.key()))
40+
.filter(Objects::nonNull)
41+
.collect(Collectors.toSet());
42+
}
43+
3344
public Set<Block> getTaggedWith(String tag) {
3445
RegistryTag<Block> data = staticRegistry.getTag(Key.key(tag));
3546
if (data == null) return new HashSet<>();
@@ -40,4 +51,7 @@ public Set<Block> getTaggedWith(String tag) {
4051
.collect(Collectors.toSet());
4152
}
4253

54+
55+
56+
4357
}

0 commit comments

Comments
 (0)