-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ore dictionary blacklisting (mainly for HarvestCraft)
- Loading branch information
Showing
3 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/com/jaquadro/minecraft/storagedrawers/config/OreDictRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.jaquadro.minecraft.storagedrawers.config; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
public class OreDictRegistry | ||
{ | ||
private Set<String> blacklist = new HashSet<String>(); | ||
private List<String> blacklistPrefix = new ArrayList<String>(); | ||
|
||
public OreDictRegistry () { | ||
register("logWood"); | ||
register("plankWood"); | ||
register("slabWood"); | ||
register("stairWood"); | ||
register("treeSapling"); | ||
register("treeLeaves"); | ||
register("blockGlass"); | ||
register("paneGlass"); | ||
register("record"); | ||
|
||
registerPrefix("list"); | ||
} | ||
|
||
public void register (String entry) { | ||
if (!blacklist.contains(entry)) | ||
blacklist.add(entry); | ||
} | ||
|
||
public void registerPrefix (String entry) { | ||
blacklistPrefix.add(entry); | ||
} | ||
|
||
public boolean isEntryBlacklisted (String entry) { | ||
if (blacklist.contains(entry)) | ||
return true; | ||
|
||
for (int i = 0; i < blacklistPrefix.size(); i++) { | ||
if (entry.startsWith(blacklistPrefix.get(i))) | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} |