mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-27 07:13:14 +00:00
Big improvements on the compression handler.
This commit is contained in:
1 parent
a2a25626d4
commit
ff3e2685ff
3 files changed
+120
-30
No files matched your search
+22
-7
@@ -1,22 +1,37 @@
|
||||
package WayofTime.alchemicalWizardry.common.routing;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.RoutingFocusLogic;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||
import WayofTime.alchemicalWizardry.api.RoutingFocusLogic;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
|
||||
public class RoutingFocusLogicModItems extends RoutingFocusLogic
|
||||
{
|
||||
@Override
|
||||
public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack)
|
||||
{
|
||||
if(keyStack != null && checkedStack != null)
|
||||
if(keyStack != null && checkedStack != null && keyStack.getItem() != null && checkedStack.getItem() != null)
|
||||
{
|
||||
UniqueIdentifier keyId = GameRegistry.findUniqueIdentifierFor(keyStack.getItem());
|
||||
UniqueIdentifier checkedId = GameRegistry.findUniqueIdentifierFor(checkedStack.getItem());
|
||||
return keyId.modId.equals(checkedId.modId);
|
||||
String keyId = getModID(keyStack.getItem());
|
||||
String checkedId = getModID(checkedStack.getItem());
|
||||
return keyId.equals(checkedId);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getModID(Item itm)
|
||||
{
|
||||
String str = GameData.getItemRegistry().getNameForObject(itm);
|
||||
if(!str.isEmpty())
|
||||
{
|
||||
String[] strs = str.split(":");
|
||||
if(strs != null && strs.length >= 1)
|
||||
{
|
||||
return strs[0];
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user