Fixed creative players being able to break an unbreakable floating artefact entity

This commit is contained in:
Sollace 2023-08-30 21:33:48 +01:00
parent d39c003c2e
commit 1f64e6c4a6
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -186,6 +186,11 @@ public class FloatingArtefactEntity extends Entity implements UDamageSources, Ma
@Override @Override
public boolean damage(DamageSource damageSource, float amount) { public boolean damage(DamageSource damageSource, float amount) {
if (getWorld().isClient || isInvulnerable()) {
return false;
}
if (isInvulnerableTo(damageSource) || !getStack().getItem().damage(damageSource)) { if (isInvulnerableTo(damageSource) || !getStack().getItem().damage(damageSource)) {
return false; return false;
} }