Skip to content

Commit

Permalink
Update to use newer Registry methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Apr 2, 2016
1 parent d94de78 commit ff8af2c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
8 changes: 8 additions & 0 deletions changelog.html
@@ -1,3 +1,11 @@
<h2>3.2.2</h2>
<h4>Fixes:</h4>
<ul>
<li>Update to use newer Registry methods.</li>
</ul>
<br/>
<hr/>

<h2>3.2.1</h2>
<h4>Fixes:</h4>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Expand Up @@ -5,4 +5,4 @@ curse_project_id=238222

version_major=3
version_minor=2
version_patch=1
version_patch=2
3 changes: 2 additions & 1 deletion src/main/java/mezz/jei/JustEnoughItems.java
Expand Up @@ -56,7 +56,8 @@ public void preInit(@Nonnull FMLPreInitializationEvent event) {
String name = "jeiDebug";
Item debugItem = new DebugItem(name);
debugItem.setUnlocalizedName(name);
GameRegistry.registerItem(debugItem, name);
debugItem.setRegistryName(name);
GameRegistry.register(debugItem);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mezz/jei/util/ItemStackElement.java
Expand Up @@ -58,7 +58,7 @@ private ItemStackElement(@Nonnull ItemStack itemStack) {
Item item = itemStack.getItem();

EntityPlayer player = Minecraft.getMinecraft().thePlayer;
ResourceLocation itemResourceLocation = GameData.getItemRegistry().getNameForObject(item);
ResourceLocation itemResourceLocation = Item.itemRegistry.getNameForObject(item);
String modId = itemResourceLocation.getResourceDomain().toLowerCase(Locale.ENGLISH);
String modName = Internal.getItemRegistry().getModNameForItem(item).toLowerCase(Locale.ENGLISH);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mezz/jei/util/ModList.java
Expand Up @@ -29,7 +29,7 @@ public ModList() {

@Nonnull
public String getModNameForItem(@Nonnull Item item) {
ResourceLocation itemResourceLocation = GameData.getItemRegistry().getNameForObject(item);
ResourceLocation itemResourceLocation = Item.itemRegistry.getNameForObject(item);
String modId = itemResourceLocation.getResourceDomain();
String lowercaseModId = modId.toLowerCase(Locale.ENGLISH);
String modName = modNamesForIds.get(lowercaseModId);
Expand Down
12 changes: 4 additions & 8 deletions src/main/java/mezz/jei/util/StackHelper.java
Expand Up @@ -10,8 +10,6 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry;
import net.minecraftforge.fml.common.registry.GameData;
import net.minecraftforge.oredict.OreDictionary;

import javax.annotation.Nonnull;
Expand Down Expand Up @@ -322,10 +320,9 @@ public String getModId(@Nonnull ItemStack stack) {

@Nonnull
public String getModId(@Nonnull Item item) {
FMLControlledNamespacedRegistry<Item> itemRegistry = GameData.getItemRegistry();
ResourceLocation itemName = itemRegistry.getNameForObject(item);
ResourceLocation itemName = Item.itemRegistry.getNameForObject(item);
if (itemName == null) {
throw new NullPointerException("GameData.getItemRegistry().getNameForObject returned null for: " + item.getClass());
throw new NullPointerException("Item.itemRegistry.getNameForObject returned null for: " + item.getClass());
}

return itemName.getResourceDomain();
Expand All @@ -350,10 +347,9 @@ public String getUniqueIdentifierForStack(@Nonnull ItemStack stack, @Nonnull Uid
throw new NullPointerException("Found an itemStack with a null item. This is an error from another mod.");
}

FMLControlledNamespacedRegistry<Item> itemRegistry = GameData.getItemRegistry();
ResourceLocation itemName = itemRegistry.getNameForObject(item);
ResourceLocation itemName = Item.itemRegistry.getNameForObject(item);
if (itemName == null) {
throw new NullPointerException("GameData.getItemRegistry().getNameForObject returned null for: " + item.getClass());
throw new NullPointerException("Item.itemRegistry.getNameForObject returned null for: " + item.getClass());
}

String itemNameString = itemName.toString();
Expand Down

0 comments on commit ff8af2c

Please sign in to comment.