Skip to content

Commit

Permalink
Added 4.5 points of armor to the player.
Browse files Browse the repository at this point in the history
  • Loading branch information
Snorps authored May 24, 2023
1 parent 506839b commit 5a56c23
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/net/snorps/unpunished/mixin/PlayerMixin.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.snorps.unpunished.mixin;

import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand Down Expand Up @@ -36,4 +38,10 @@ public void getCurrentExperience(Player attacker, CallbackInfoReturnable<Integer

ci.setReturnValue(points);
}
}

@Inject(at=@At("RETURN"), method= "createAttributes", cancellable=true)
private static void addArmor(CallbackInfoReturnable<AttributeSupplier.Builder> ci) {
AttributeSupplier.Builder db = ci.getReturnValue();
ci.setReturnValue(db.add(Attributes.ARMOR, 4.5));
}
}

0 comments on commit 5a56c23

Please sign in to comment.