Use block and item registries instead of using delegate directly

allows compatibility with older Forge
This commit is contained in:
mezz committed 2015-08-15 19:01:30 -07:00
1 parent 8eb4afc464
commit 56c06ab6ed
2 files changed
+6 -3

No files matched your search

@@ -44,6 +44,7 @@ import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.VillagerRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -428,7 +429,7 @@ public class PluginApiculture extends ForestryPlugin {
List<String> plantableFlowerNames = new ArrayList<String>();
if (flowers != null) {
for (IFlower flower : flowers) {
String name = flower.getBlock().delegate.name();
String name = GameData.getBlockRegistry().getNameForObject(flower.getBlock());
if (name == null) {
Proxies.log.severe("Could not find name for flower: " + flower + " with type: " + flowerType);
continue;
@@ -22,6 +22,8 @@ import net.minecraft.util.StatCollector;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.registry.GameData;
import forestry.api.storage.IBackpackDefinition;
public class BackpackDefinition implements IBackpackDefinition {
@@ -88,7 +90,7 @@ public class BackpackDefinition implements IBackpackDefinition {
return;
}
String itemStackString = item.delegate.name();
String itemStackString = GameData.getItemRegistry().getNameForObject(item);
int meta = validItem.getItemDamage();
if (meta != OreDictionary.WILDCARD_VALUE) {
@@ -174,7 +176,7 @@ public class BackpackDefinition implements IBackpackDefinition {
return false;
}
String itemStackStringWild = item.delegate.name();
String itemStackStringWild = GameData.getItemRegistry().getNameForObject(item);
if (validItemStacks.contains(itemStackStringWild)) {
return true;
}