Skip to content

Commit

Permalink
Updated premade classes to use TagKey
Browse files Browse the repository at this point in the history
  • Loading branch information
StellarWind22 committed Mar 3, 2022
1 parent 3abd83c commit 1eb881b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.18.2+build.1
loader_version=0.13.3

# Mod Properties
mod_version=1.5.1-1.18
mod_version=1.5.2-1.18
maven_group=com.github.crimsondawn45
archives_base_name=FabricShieldLib

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterial;
import net.minecraft.recipe.Ingredient;
import net.minecraft.tag.Tag;
import net.minecraft.tag.TagKey;
import net.minecraft.text.Text;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Hand;
Expand All @@ -36,9 +36,9 @@ public class FabricBannerShieldItem extends Item implements FabricShield {

//Repair stuff
private Item[] repairItems;
private Tag<Item> repairTag;
private TagKey<Item> repairTag;
private Ingredient repairIngredients;
private Collection<Tag<Item>> repairTags;
private Collection<TagKey<Item>> repairTags;

private RepairItemType repairType;

Expand Down Expand Up @@ -97,7 +97,7 @@ public FabricBannerShieldItem(Settings settings, int cooldownTicks, ToolMaterial
* @param enchantability enchantability of shield. Vanilla: 9
* @param repairItemTag item tag for repairing shield.
*/
public FabricBannerShieldItem(Settings settings, int cooldownTicks, int enchantability, Tag<Item> repairItemTag) {
public FabricBannerShieldItem(Settings settings, int cooldownTicks, int enchantability, TagKey<Item> repairItemTag) {
super(settings);

//Register dispenser equip behavior
Expand All @@ -122,7 +122,7 @@ public FabricBannerShieldItem(Settings settings, int cooldownTicks, int enchanta
* @param enchantability enchantability of shield. Vanilla: 9
* @param repairItemTag list of item tags for repairing shield.
*/
public FabricBannerShieldItem(Settings settings, int cooldownTicks, int enchantability, Collection<Tag<Item>> repairItemTags) {
public FabricBannerShieldItem(Settings settings, int cooldownTicks, int enchantability, Collection<TagKey<Item>> repairItemTags) {
super(settings);

//Register dispenser equip behavior
Expand Down Expand Up @@ -193,11 +193,11 @@ public boolean canRepair(ItemStack stack, ItemStack ingredient) {
}
}
return false;
case TAG: return this.repairTag.values().contains(ingredient.getItem());
case TAG: return ingredient.isIn(this.repairTag);
case INGREDIENT: return this.repairIngredients.test(ingredient);
case TAG_ARRAY:
for(Tag<Item> tag : this.repairTags) {
if(tag.values().contains(ingredient.getItem())) {
for(TagKey<Item> tag : this.repairTags) {
if(ingredient.isIn(tag)) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterial;
import net.minecraft.recipe.Ingredient;
import net.minecraft.tag.Tag;
import net.minecraft.tag.TagKey;
import net.minecraft.text.Text;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
Expand All @@ -32,9 +32,9 @@ public class FabricShieldItem extends Item implements FabricShield {

//Repair stuff
private Item[] repairItems;
private Tag<Item> repairTag;
private TagKey<Item> repairTag;
private Ingredient repairIngredients;
private Collection<Tag<Item>> repairTags;
private Collection<TagKey<Item>> repairTags;

private RepairItemType repairType;

Expand Down Expand Up @@ -93,7 +93,7 @@ public FabricShieldItem(Settings settings, int cooldownTicks, ToolMaterial mater
* @param enchantability enchantability of shield. Vanilla: 14
* @param repairItemTag item tag for repairing shield
*/
public FabricShieldItem(Settings settings, int cooldownTicks, int enchantability, Tag<Item> repairItemTag) {
public FabricShieldItem(Settings settings, int cooldownTicks, int enchantability, TagKey<Item> repairItemTag) {
super(settings); //Make durability match material

//Register dispenser equip behavior
Expand All @@ -118,7 +118,7 @@ public FabricShieldItem(Settings settings, int cooldownTicks, int enchantability
* @param enchantability enchantability of shield. Vanilla: 9
* @param repairItemTag list of item tags for repairing shield.
*/
public FabricShieldItem(Settings settings, int cooldownTicks, int enchantability, Collection<Tag<Item>> repairItemTags) {
public FabricShieldItem(Settings settings, int cooldownTicks, int enchantability, Collection<TagKey<Item>> repairItemTags) {
super(settings);

//Register dispenser equip behavior
Expand Down Expand Up @@ -172,11 +172,11 @@ public boolean canRepair(ItemStack stack, ItemStack ingredient) {
}
}
return false;
case TAG: return this.repairTag.values().contains(ingredient.getItem());
case TAG: return ingredient.isIn(this.repairTag);
case INGREDIENT: return this.repairIngredients.test(ingredient);
case TAG_ARRAY:
for(Tag<Item> tag : this.repairTags) {
if(tag.values().contains(ingredient.getItem())) {
for(TagKey<Item> tag : this.repairTags) {
if(ingredient.isIn(tag)) {
return true;
}
}
Expand Down

0 comments on commit 1eb881b

Please sign in to comment.