Skip to content

Commit

Permalink
Merge pull request #116 from williambl/tame-with-oredict
Browse files Browse the repository at this point in the history
Add oredict support to taming item config (Closes #110)
  • Loading branch information
itsmeow committed Nov 22, 2019
2 parents 16ef1d4 + b487447 commit 2d08363
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.entity.passive.EntityTameable;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;

public abstract class EntityTameableBetterAnimalsPlus extends EntityTameable {

Expand All @@ -21,6 +22,11 @@ public boolean isTamingItem(Item item) {
String[] items = section.tameItems;
String id = item.getRegistryName().toString();
for(String itemsId : items) {
if (itemsId.startsWith("ore:")) {
if (OreDictionary.getOres(itemsId.substring(4)).stream().anyMatch(itemStack -> itemStack.getItem() == item)) {
return true;
}
}
if(id.equals(itemsId)) {
return true;
}
Expand Down

0 comments on commit 2d08363

Please sign in to comment.