Skip to content

Commit

Permalink
remove cuboidtag filter stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Feb 4, 2020
1 parent 7e43556 commit 8db114c
Showing 1 changed file with 3 additions and 50 deletions.
Expand Up @@ -74,7 +74,6 @@ public CuboidTag clone() {
for (LocationPair pair : pairs) {
cuboid.pairs.add(new LocationPair(pair.point_1.clone(), pair.point_2.clone()));
}
cuboid.filter = new ArrayList<>(filter);
return cuboid;
}

Expand Down Expand Up @@ -267,9 +266,6 @@ public void generateDistances() {
// Location Pairs (low, high) that make up the CuboidTag
public List<LocationPair> pairs = new ArrayList<>();

// Only put MaterialTags in filter.
ArrayList<ObjectTag> filter = new ArrayList<>();

/**
* Construct the cuboid without adding pairs
* ONLY use this if addPair will be called immediately after!
Expand Down Expand Up @@ -320,27 +316,6 @@ public boolean isInsideCuboid(Location location) {
return false;
}

public CuboidTag addBlocksToFilter(List<MaterialTag> addl) {
filter.addAll(addl);
return this;
}

public CuboidTag removeBlocksFromFilter(List<MaterialTag> addl) {
filter.removeAll(addl);
return this;
}

public CuboidTag removeFilter() {
filter.clear();
return this;
}

public CuboidTag setAsFilter(List<MaterialTag> list) {
filter.clear();
filter.addAll(list);
return this;
}

public ListTag getShell() {
int max = Settings.blockTagsMaxBlocks();
int index = 0;
Expand Down Expand Up @@ -517,7 +492,7 @@ public ListTag getBlocks(List<MaterialTag> materials, Attribute attribute) {
}

public List<LocationTag> getBlocks_internal(List<MaterialTag> materials, Attribute attribute) {
if (materials == null && filter.isEmpty()) {
if (materials == null) {
return getBlockLocationsUnfiltered();
}
int max = Settings.blockTagsMaxBlocks();
Expand All @@ -539,20 +514,8 @@ public List<LocationTag> getBlocks_internal(List<MaterialTag> materials, Attribu
if (loc.getY() < 0 || loc.getY() > 255) {
continue;
}
if (!filter.isEmpty()) { // TODO: Should 'filter' exist?
// Check filter
for (ObjectTag material : filter) {
if (((MaterialTag) material).matchesBlock(loc.getBlockForTag(attribute))) {
if (matchesMaterialList(loc, materials, attribute)) {
list.add(loc);
}
}
}
}
else {
if (matchesMaterialList(loc, materials, attribute)) {
list.add(loc);
}
if (matchesMaterialList(loc, materials, attribute)) {
list.add(loc);
}
index++;
if (index > max) {
Expand Down Expand Up @@ -831,16 +794,6 @@ public static void registerTags() {
return cuboid.getOutline();
}, "get_outline");

// <--[tag]
// @attribute <CuboidTag.filter>
// @returns ListTag(LocationTag)
// @description
// Returns the block locations from the CuboidTag's filter.
// -->
registerTag("filter", (attribute, cuboid) -> {
return new ListTag(cuboid.filter);
});

// <--[tag]
// @attribute <CuboidTag.intersects[<cuboid>]>
// @returns ElementTag(Boolean)
Expand Down

0 comments on commit 8db114c

Please sign in to comment.