mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-16 04:33:56 -07:00
Add api for shear equippable logic
This commit is contained in:
@@ -82,6 +82,16 @@ public record PaperEquippable(
|
||||
return this.impl.equipOnInteract();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeSheared() {
|
||||
return this.impl.canBeSheared();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key shearSound() {
|
||||
return PaperAdventure.asAdventure(this.impl.equipSound().value().location());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return new BuilderImpl(this.slot())
|
||||
@@ -92,7 +102,9 @@ public record PaperEquippable(
|
||||
.dispensable(this.dispensable())
|
||||
.swappable(this.swappable())
|
||||
.damageOnHurt(this.damageOnHurt())
|
||||
.equipOnInteract(this.equipOnInteract());
|
||||
.equipOnInteract(this.equipOnInteract())
|
||||
.shearSound(this.shearSound())
|
||||
.canBeSheared(this.canBeSheared());
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +119,8 @@ public record PaperEquippable(
|
||||
private boolean swappable = true;
|
||||
private boolean damageOnHurt = true;
|
||||
private boolean equipOnInteract;
|
||||
private boolean canBeSheared = false;
|
||||
private Holder<SoundEvent> shearSound = BuiltInRegistries.SOUND_EVENT.wrapAsHolder(SoundEvents.SHEARS_SNIP);
|
||||
|
||||
BuilderImpl(final EquipmentSlot equipmentSlot) {
|
||||
this.equipmentSlot = CraftEquipmentSlot.getNMS(equipmentSlot);
|
||||
@@ -165,6 +179,18 @@ public record PaperEquippable(
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder canBeSheared(final boolean canBeSheared) {
|
||||
this.canBeSheared = canBeSheared;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder shearSound(final Key shearSound) {
|
||||
this.shearSound = PaperAdventure.resolveSound(shearSound);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Equippable build() {
|
||||
return new PaperEquippable(
|
||||
@@ -178,8 +204,8 @@ public record PaperEquippable(
|
||||
this.swappable,
|
||||
this.damageOnHurt,
|
||||
this.equipOnInteract,
|
||||
false, // TODO
|
||||
Holder.direct(SoundEvents.GOAT_SCREAMING_DEATH) // TODO
|
||||
this.canBeSheared,
|
||||
this.shearSound
|
||||
)
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user