-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove legacy item tags for biomass
- Loading branch information
1 parent
8a9df68
commit dd31596
Showing
7 changed files
with
65 additions
and
23 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
33 changes: 33 additions & 0 deletions
33
src/main/java/com/github/elenterius/biomancy/advancements/predicate/FoodItemPredicate.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,33 @@ | ||
package com.github.elenterius.biomancy.advancements.predicate; | ||
|
||
import com.github.elenterius.biomancy.BiomancyMod; | ||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonObject; | ||
import net.minecraft.advancements.critereon.ItemPredicate; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.ItemStack; | ||
|
||
public class FoodItemPredicate extends ItemPredicate { | ||
|
||
public static final ResourceLocation ID = BiomancyMod.createRL("is_food_item"); | ||
|
||
public FoodItemPredicate() {} | ||
|
||
@Override | ||
public boolean matches(ItemStack stack) { | ||
if (!stack.isEdible()) return false; | ||
return stack.getFoodProperties(null) != null; | ||
} | ||
|
||
@Override | ||
public JsonElement serializeToJson() { | ||
JsonObject jsonObject = new JsonObject(); | ||
jsonObject.addProperty("type", ID.toString()); | ||
return jsonObject; | ||
} | ||
|
||
public static FoodItemPredicate deserializeFromJson(JsonObject jsonObject) { | ||
return new FoodItemPredicate(); | ||
} | ||
|
||
} |
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
14 changes: 14 additions & 0 deletions
14
src/main/java/com/github/elenterius/biomancy/init/ModPredicates.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,14 @@ | ||
package com.github.elenterius.biomancy.init; | ||
|
||
import com.github.elenterius.biomancy.advancements.predicate.FoodItemPredicate; | ||
import net.minecraft.advancements.critereon.ItemPredicate; | ||
|
||
public final class ModPredicates { | ||
|
||
private ModPredicates() {} | ||
|
||
public static void registerItemPredicates() { | ||
ItemPredicate.register(FoodItemPredicate.ID, FoodItemPredicate::deserializeFromJson); | ||
} | ||
|
||
} |
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