mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-16 18:44:44 +00:00
Added proper blacklists for the Ring of Magnetization.
This commit is contained in:
1 parent
b5af383f61
commit
1c1e6525e9
6 files changed
+84
-6
No files matched your search
@@ -83,8 +83,9 @@ public final class BotaniaAPI {
|
||||
public static Map<String, Integer> oreWeights = new HashMap<String, Integer>();
|
||||
public static Map<String, Integer> oreWeightsNether = new HashMap<String, Integer>();
|
||||
public static Map<Item, Block> seeds = new HashMap();
|
||||
public static Set<Item> looniumBlacklist = new LinkedHashSet();
|
||||
public static Set<Item> looniumBlacklist = new LinkedHashSet<Item>();
|
||||
public static Set<Block> paintableBlocks = new LinkedHashSet<Block>();
|
||||
public static Set<String> magnetBlacklist = new LinkedHashSet<String>();
|
||||
|
||||
public static ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", 16, new int[] { 2, 6, 5, 2 }, 18);
|
||||
public static ToolMaterial manasteelToolMaterial = EnumHelper.addToolMaterial("MANASTEEL", 3, 300, 6.2F, 2F, 20);
|
||||
@@ -281,6 +282,47 @@ public final class BotaniaAPI {
|
||||
paintableBlocks.add(paintable);
|
||||
return paintable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Blacklists an item from being pulled by the Ring of Magnetization.
|
||||
* Short.MAX_VALUE can be used as the stack's damage for a wildcard.
|
||||
*/
|
||||
public static void blacklistItemFromMagnet(ItemStack stack) {
|
||||
String key = getMagnetKey(stack);
|
||||
magnetBlacklist.add(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Blacklists a block from having items on top of it being pulled by the Ring of Magnetization.
|
||||
* Short.MAX_VALUE can be used as meta for a wildcard.
|
||||
*/
|
||||
public static void blacklistBlockFromMagnet(Block block, int meta) {
|
||||
String key = getMagnetKey(block, meta);
|
||||
magnetBlacklist.add(key);
|
||||
}
|
||||
|
||||
public static boolean isItemBlacklistedFromMagnet(ItemStack stack) {
|
||||
if(stack.getItemDamage() != Short.MAX_VALUE) {
|
||||
ItemStack copy = new ItemStack(stack.getItem(), 0, Short.MAX_VALUE);
|
||||
boolean general = isItemBlacklistedFromMagnet(copy);
|
||||
if(general)
|
||||
return true;
|
||||
}
|
||||
|
||||
String key = getMagnetKey(stack);
|
||||
return magnetBlacklist.contains(key);
|
||||
}
|
||||
|
||||
public static boolean isBlockBlacklistedFromMagnet(Block block, int meta) {
|
||||
if(meta != Short.MAX_VALUE) {
|
||||
boolean general = isBlockBlacklistedFromMagnet(block, Short.MAX_VALUE);
|
||||
if(general)
|
||||
return true;
|
||||
}
|
||||
|
||||
String key = getMagnetKey(block, meta);
|
||||
return magnetBlacklist.contains(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Petal Recipe.
|
||||
@@ -559,4 +601,19 @@ public final class BotaniaAPI {
|
||||
public static Set<String> getAllSubTiles() {
|
||||
return subTiles.keySet();
|
||||
}
|
||||
|
||||
private static String getMagnetKey(ItemStack stack) {
|
||||
if(stack == null)
|
||||
return "";
|
||||
|
||||
return "i_" + stack.getItem().getUnlocalizedName() + "@" + stack.getItemDamage();
|
||||
}
|
||||
|
||||
private static String getMagnetKey(Block block, int meta) {
|
||||
if(meta == -1)
|
||||
return "b_" + block.getUnlocalizedName();
|
||||
|
||||
return "bm_" + block.getUnlocalizedName() + "@" + meta;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user