Skip to content

Commit

Permalink
add tag to make items unfixable by the FixItemsEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
bl4ckscor3 committed Feb 21, 2023
1 parent 3e6edad commit b6203c6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/java/me/juancarloscp52/entropy/EntropyTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ public class EntropyTags {
public static final TagKey<Item> DOES_NOT_DROP_RANDOMLY = TagKey.of(Registries.ITEM.getKey(), new Identifier("entropy", "does_not_drop_randomly"));
public static final TagKey<Item> DOES_NOT_RAIN = TagKey.of(Registries.ITEM.getKey(), new Identifier("entropy", "does_not_rain"));
public static final TagKey<Item> BANNED = TagKey.of(Registries.ITEM.getKey(), new Identifier("entropy", "banned"));
public static final TagKey<Item> UNFIXABLE = TagKey.of(Registries.ITEM.getKey(), new Identifier("entropy", "unfixable"));
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package me.juancarloscp52.entropy.events.db;

import me.juancarloscp52.entropy.Entropy;
import me.juancarloscp52.entropy.EntropyTags;
import me.juancarloscp52.entropy.events.AbstractInstantEvent;
import net.minecraft.advancement.criterion.Criteria;
import net.minecraft.item.ItemStack;
Expand All @@ -27,6 +28,9 @@ public class FixItemsEvent extends AbstractInstantEvent {


public void fixItem(ItemStack stack, ServerPlayerEntity player){
if(stack.isIn(EntropyTags.UNFIXABLE))
return;

Criteria.ITEM_DURABILITY_CHANGED.trigger(player, stack, stack.getMaxDamage());
stack.setDamage(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.registry.entry.RegistryEntry.Reference;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.World;

Expand Down

0 comments on commit b6203c6

Please sign in to comment.