forked from xsun2001/Applied-Energistics-2-Unofficial
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor blocking mode ignore item list (#678)
- Loading branch information
Showing
9 changed files
with
110 additions
and
207 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
25 changes: 25 additions & 0 deletions
25
src/main/java/appeng/api/features/IBlockingModeIgnoreItemRegistry.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,25 @@ | ||
package appeng.api.features; | ||
|
||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
|
||
/** | ||
* Registry for items that are ignored by blocking mode of interfaces. | ||
*/ | ||
public interface IBlockingModeIgnoreItemRegistry { | ||
|
||
/** | ||
* Registers item to be ignored by blocking mode of interfaces. Matches with any metadata. | ||
*/ | ||
void register(Item item); | ||
|
||
/** | ||
* Registers item to be ignored by blocking mode of interfaces. Matches with the supplied metadata. | ||
*/ | ||
void register(ItemStack itemStack); | ||
|
||
/** | ||
* Checks if given item should be ignored by blocking mode. | ||
*/ | ||
boolean isIgnored(ItemStack itemStack); | ||
} |
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
63 changes: 63 additions & 0 deletions
63
src/main/java/appeng/core/features/registries/BlockingModeIgnoreItemRegistry.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,63 @@ | ||
package appeng.core.features.registries; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
|
||
import com.gtnewhorizon.gtnhlib.util.map.ItemStackMap; | ||
|
||
import appeng.api.features.IBlockingModeIgnoreItemRegistry; | ||
import cpw.mods.fml.common.Loader; | ||
import cpw.mods.fml.common.registry.GameRegistry; | ||
|
||
public class BlockingModeIgnoreItemRegistry implements IBlockingModeIgnoreItemRegistry { | ||
|
||
private static BlockingModeIgnoreItemRegistry INSTANCE; | ||
|
||
private final Set<Item> items = new HashSet<>(); | ||
private final ItemStackMap<Boolean> itemStacks = new ItemStackMap<>(); | ||
|
||
BlockingModeIgnoreItemRegistry() { | ||
INSTANCE = this; | ||
} | ||
|
||
@Override | ||
public void register(Item item) { | ||
this.items.add(item); | ||
} | ||
|
||
@Override | ||
public void register(ItemStack itemStack) { | ||
this.itemStacks.put(itemStack, true); | ||
} | ||
|
||
@Override | ||
public boolean isIgnored(ItemStack itemStack) { | ||
return this.items.contains(itemStack.getItem()) || itemStacks.containsKey(itemStack); | ||
} | ||
|
||
public static BlockingModeIgnoreItemRegistry instance() { | ||
return INSTANCE; | ||
} | ||
|
||
public void registerDefault() { | ||
if (Loader.isModLoaded("AWWayofTime")) { // blood magic | ||
register(GameRegistry.findItem("AWWayofTime", "weakBloodOrb")); | ||
register(GameRegistry.findItem("AWWayofTime", "apprenticeBloodOrb")); | ||
register(GameRegistry.findItem("AWWayofTime", "magicianBloodOrb")); | ||
register(GameRegistry.findItem("AWWayofTime", "masterBloodOrb")); | ||
register(GameRegistry.findItem("AWWayofTime", "archmageBloodOrb")); | ||
register(GameRegistry.findItem("AWWayofTime", "transcendentBloodOrb")); | ||
|
||
if (Loader.isModLoaded("Avaritia")) { | ||
register(GameRegistry.findItem("Avaritia", "Orb_Armok")); | ||
} | ||
|
||
if (Loader.isModLoaded("ForbiddenMagic")) { | ||
register(GameRegistry.findItem("ForbiddenMagic", "EldritchOrb")); | ||
} | ||
} | ||
} | ||
} |
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
200 changes: 0 additions & 200 deletions
200
src/main/java/appeng/helpers/BlockingModeIgnoreList.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.