Skip to content

Commit

Permalink
Implement Attribute#removeModifier(ResourceKey) (#4076)
Browse files Browse the repository at this point in the history
  • Loading branch information
avaruus1 authored Jul 7, 2024
1 parent 17a8710 commit 59d7fd5
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public abstract class AttributeInstanceMixin_API implements Attribute {
@Shadow public abstract double shadow$getValue();
@Shadow protected abstract void shadow$addModifier(net.minecraft.world.entity.ai.attributes.AttributeModifier modifier);
@Shadow public abstract void shadow$removeModifier(net.minecraft.world.entity.ai.attributes.AttributeModifier modifier);
@Shadow public abstract boolean shadow$removeModifier(ResourceLocation $$0);
@Shadow abstract Map<UUID, net.minecraft.world.entity.ai.attributes.AttributeModifier> shadow$getModifiers(net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation p_225504_1_);
@Shadow public abstract Set<net.minecraft.world.entity.ai.attributes.AttributeModifier> shadow$getModifiers();
@Shadow public abstract boolean shadow$hasModifier(final ResourceLocation $$0);
Expand Down Expand Up @@ -111,6 +112,11 @@ public void removeModifier(final AttributeModifier modifier) {
this.shadow$removeModifier((net.minecraft.world.entity.ai.attributes.AttributeModifier) (Object) Objects.requireNonNull(modifier, "modifier"));
}

@Override
public void removeModifier(ResourceKey key) {
this.shadow$removeModifier((ResourceLocation) (Object) key);
}

@Override
public Optional<AttributeModifier> modifier(final ResourceKey key) {
return Optional.ofNullable((AttributeModifier) (Object) this.shadow$getModifier((ResourceLocation) (Object) Objects.requireNonNull(key, "uniqueId")));
Expand Down

0 comments on commit 59d7fd5

Please sign in to comment.