mirror of
https://github.com/Oth3r/Sit.git
synced 2025-09-19 16:03:22 +02:00
better block tag checker
This commit is contained in:
parent
e41f782aeb
commit
c7183506e4
1 changed files with 8 additions and 2 deletions
|
@ -78,14 +78,20 @@ public class CustomBlock {
|
|||
// if there is a match for the block, return true immediately
|
||||
if (id.equalsIgnoreCase(Utl.getBlockID(blockState))) return true;
|
||||
}
|
||||
|
||||
// a boolean to check if one of the blocks are in a filtered tag
|
||||
boolean tagCheck = false;
|
||||
|
||||
// for all the entered tags
|
||||
for (String tag : blockTags) {
|
||||
// substring to remove # and if needed, !
|
||||
// if there is a math for the NOT(!) tag, return false
|
||||
if (tag.startsWith("!") && blockState.isIn(TagKey.of(Registries.BLOCK.getKey(), Identifier.of(tag.substring(2))))) return false;
|
||||
// if there is a match, return true
|
||||
if (blockState.isIn(TagKey.of(Registries.BLOCK.getKey(), Identifier.of(tag.substring(1))))) return true;
|
||||
if (blockState.isIn(TagKey.of(Registries.BLOCK.getKey(), Identifier.of(tag.substring(1))))) tagCheck = true;
|
||||
}
|
||||
return false;
|
||||
|
||||
// not returning true in the loop because there might be a (!) not tag that the block might fall into, after the block was already in another tag
|
||||
return tagCheck;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue