-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
48 additions
and
24 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
18 changes: 18 additions & 0 deletions
18
src/main/java/org/hiedacamellia/mystiasizakaya/integration/compact/IngredientsCompact.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,18 @@ | ||
package org.hiedacamellia.mystiasizakaya.integration.compact; | ||
|
||
import net.minecraft.tags.TagKey; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.ItemStack; | ||
import org.hiedacamellia.mystiasizakaya.registries.MITag; | ||
import org.hiedacamellia.mystiasizakaya.util.Tag2Item; | ||
|
||
public class IngredientsCompact { | ||
public static ItemStack execute(ItemStack itemstack) { | ||
for(TagKey<Item> key:MITag.ingredients.values()){ | ||
if(itemstack.is(key)){ | ||
return Tag2Item.regs.get(key).getDefaultInstance(); | ||
} | ||
} | ||
return itemstack; | ||
} | ||
} |
20 changes: 0 additions & 20 deletions
20
...ava/org/hiedacamellia/mystiasizakaya/integration/youkaihomecoming/IngredientsCompact.java
This file was deleted.
Oops, something went wrong.
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
26 changes: 26 additions & 0 deletions
26
src/main/java/org/hiedacamellia/mystiasizakaya/util/Tag2Item.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,26 @@ | ||
package org.hiedacamellia.mystiasizakaya.util; | ||
|
||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.tags.TagKey; | ||
import net.minecraft.world.item.Item; | ||
import net.neoforged.neoforge.registries.DeferredHolder; | ||
import org.hiedacamellia.mystiasizakaya.registries.MIItem; | ||
import org.hiedacamellia.mystiasizakaya.registries.MITag; | ||
|
||
import java.util.*; | ||
|
||
|
||
public class Tag2Item { | ||
|
||
public static Map<TagKey<Item>,Item> regs = get(); | ||
|
||
public static Map<TagKey<Item>,Item> get() { | ||
Collection<DeferredHolder<Item, ? extends Item>> knownIngredients = MIItem.Ingredients.getEntries(); | ||
Map<TagKey<Item>,Item> regs = new HashMap<>(); | ||
Map<String,TagKey<Item>> ingredients = MITag.getKnownIngredients(); | ||
for(DeferredHolder<Item, ? extends Item> item: knownIngredients){ | ||
regs.put(ingredients.get(BuiltInRegistries.ITEM.getKey(item.get()).getPath()),item.get()); | ||
} | ||
return regs; | ||
} | ||
} |