Skip to content

Commit 34018d6

Browse files
committed
veinmining now only mines the vein that have been fully placed by world
1 parent edaef33 commit 34018d6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/main/java/redart15/commandly/veincapitator/VeinMining.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ public boolean mine(int blockId, Side side) {
108108

109109
private boolean canBeVeinMined(Block<?> block) {
110110
Block<?> theBlock = world.getBlock(point.x, point.y, point.z);
111-
int metadata = world.getBlockMetadata(point.x, point.y, point.z);
112-
if (theBlock == null || theBlock.id() != block.id() || this.isSmartMiner(block, metadata)) {
111+
if (theBlock == null || theBlock.id() != block.id()) {
113112
return false;
114113
}
115114
if (!block.hasTag(miningTag)) {
@@ -129,11 +128,11 @@ private boolean canBeVeinMined(Block<?> block) {
129128
return block.hasTag(ORE) || this.languageKeyOre(block);
130129
}
131130

132-
private boolean isSmartMiner(Block<?> block, int metadata) {
131+
private boolean isSmartMiner(@NotNull Block<?> block, int metadata) {
133132
if(!CommandlyConfig.SMART_VEINMINER){
134133
return false;
135134
}
136-
return !(block == null || block.getLogic() instanceof IPaintable) && (metadata >> 7) == 1;
135+
return block.getLogic() instanceof IPaintable || (metadata >> MASK) == 1;
137136
}
138137

139138
private boolean languageKeyOre(Block<?> block) {
@@ -175,6 +174,7 @@ private Set<ChunkPosition> findAllOreBlocks(int veinSize) {
175174
if (visited.contains(to)) continue;
176175
Block<?> nextBlock = this.world.getBlock(to.x, to.y, to.z);
177176
if (nextBlock == null || !this.miningGroup.contains(nextBlock.namespaceId())) continue;
177+
if (isSmartMiner(nextBlock, world.getBlockMetadata(to.x, to.y, to.z))) continue;
178178
visited.add(to);
179179
queue.add(to);
180180
veinSize--;

0 commit comments

Comments
 (0)