Friction API

This commit is contained in:
Noah van der Aa
2021-09-15 20:44:22 +02:00
parent 4a416ca85a
commit e151b6fc3f
8 changed files with 286 additions and 152 deletions

View File

@@ -99,6 +99,18 @@ public class CraftItem extends CraftEntity implements Item {
this.getHandle().age = willAge ? 0 : NO_AGE_TIME;
}
@org.jetbrains.annotations.NotNull
@Override
public net.kyori.adventure.util.TriState getFrictionState() {
return this.getHandle().frictionState;
}
@Override
public void setFrictionState(@org.jetbrains.annotations.NotNull net.kyori.adventure.util.TriState state) {
java.util.Objects.requireNonNull(state, "state may not be null");
this.getHandle().frictionState = state;
}
@Override
public int getHealth() {
return this.getHandle().health;

View File

@@ -1198,4 +1198,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
nmsStack.hurtAndBreak(amount, this.getHandle(), slot, true);
}
// Paper end - ItemStack damage API
// Paper start - friction API
@org.jetbrains.annotations.NotNull
@Override
public net.kyori.adventure.util.TriState getFrictionState() {
return this.getHandle().frictionState;
}
@Override
public void setFrictionState(@org.jetbrains.annotations.NotNull net.kyori.adventure.util.TriState state) {
java.util.Objects.requireNonNull(state, "state may not be null");
this.getHandle().frictionState = state;
}
// Paper end - friction API
}

View File

@@ -127,4 +127,18 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart {
public int getDisplayBlockOffset() {
return this.getHandle().getDisplayOffset();
}
// Paper start - Friction API
@org.jetbrains.annotations.NotNull
@Override
public net.kyori.adventure.util.TriState getFrictionState() {
return this.getHandle().frictionState;
}
@Override
public void setFrictionState(@org.jetbrains.annotations.NotNull net.kyori.adventure.util.TriState state) {
java.util.Objects.requireNonNull(state, "state may not be null");
this.getHandle().frictionState = state;
}
// Paper end - Friction API
}