Add more Campfire API

This commit is contained in:
LemonCaramel
2021-07-16 00:39:03 +09:00
parent 8e42edf892
commit c5e4146598
2 changed files with 90 additions and 2 deletions

View File

@@ -62,4 +62,40 @@ public class CraftCampfire extends CraftBlockEntityState<CampfireBlockEntity> im
public CraftCampfire copy(Location location) {
return new CraftCampfire(this, location);
}
// Paper start
@Override
public void stopCooking() {
for (int i = 0; i < getSnapshot().stopCooking.length; ++i)
this.stopCooking(i);
}
@Override
public void startCooking() {
for (int i = 0; i < getSnapshot().stopCooking.length; ++i)
this.startCooking(i);
}
@Override
public boolean stopCooking(int index) {
org.apache.commons.lang.Validate.isTrue(-1 < index && index < 4, "Slot index must be between 0 (incl) to 3 (incl)");
boolean previous = this.isCookingDisabled(index);
getSnapshot().stopCooking[index] = true;
return previous;
}
@Override
public boolean startCooking(int index) {
org.apache.commons.lang.Validate.isTrue(-1 < index && index < 4, "Slot index must be between 0 (incl) to 3 (incl)");
boolean previous = this.isCookingDisabled(index);
getSnapshot().stopCooking[index] = false;
return previous;
}
@Override
public boolean isCookingDisabled(int index) {
org.apache.commons.lang.Validate.isTrue(-1 < index && index < 4, "Slot index must be between 0 (incl) to 3 (incl)");
return getSnapshot().stopCooking[index];
}
// Paper end
}