forked from CleanroomMC/ModularUI
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(cherry picked from commit 943b4de)
- Loading branch information
Showing
4 changed files
with
99 additions
and
5 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
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
21 changes: 21 additions & 0 deletions
21
src/main/java/com/cleanroommc/modularui/utils/GameObjectHelper.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,21 @@ | ||
package com.cleanroommc.modularui.utils; | ||
|
||
import cpw.mods.fml.common.registry.GameRegistry; | ||
import net.minecraft.init.Items; | ||
import net.minecraft.item.ItemStack; | ||
|
||
import java.util.NoSuchElementException; | ||
|
||
public class GameObjectHelper { | ||
|
||
public static ItemStack getItemStack(String mod, String path) { | ||
return getItemStack(mod, path, 0); | ||
} | ||
|
||
public static ItemStack getItemStack(String mod, String path, int meta) { | ||
ItemStack item = GameRegistry.findItemStack(mod, path, 1); | ||
if (item == null) throw new NoSuchElementException("Item '" + mod + ":" + path + "' was not found!"); | ||
Items.feather.setDamage(item, meta); | ||
return item; | ||
} | ||
} |