25w03a
This commit is contained in:
1 parent
c241594eb6
commit
fd098151c4
18 files changed
+100
-39
No files matched your search
@@ -19,9 +19,6 @@ public abstract class ExperienceOrb_xpNoCooldownMixin extends Entity
|
||||
@Shadow
|
||||
private int count;
|
||||
|
||||
@Shadow
|
||||
private int value;
|
||||
|
||||
public ExperienceOrb_xpNoCooldownMixin(EntityType<?> type, Level world)
|
||||
{
|
||||
super(type, world);
|
||||
@@ -30,13 +27,15 @@ public abstract class ExperienceOrb_xpNoCooldownMixin extends Entity
|
||||
@Shadow
|
||||
protected abstract int repairPlayerItems(ServerPlayer player, int amount);
|
||||
|
||||
@Shadow public abstract int getValue();
|
||||
|
||||
@Inject(method = "playerTouch", at = @At("HEAD"))
|
||||
private void addXP(Player player, CallbackInfo ci) {
|
||||
if (CarpetSettings.xpNoCooldown && !level().isClientSide) {
|
||||
player.takeXpDelay = 0;
|
||||
// reducing the count to 1 and leaving vanilla to deal with it
|
||||
while (this.count > 1) {
|
||||
int remainder = this.repairPlayerItems((ServerPlayer) player, this.value);
|
||||
int remainder = this.repairPlayerItems((ServerPlayer) player, this.getValue());
|
||||
if (remainder > 0) {
|
||||
player.giveExperiencePoints(remainder);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user