sitting-eye-y-bounds -> height-difference-limit

This commit is contained in:
Oth3r 2025-02-13 09:50:23 -06:00
commit e8ac5722ea
2 changed files with 14 additions and 14 deletions

View file

@ -35,8 +35,8 @@ public class ServerConfig implements CustomFile<ServerConfig> {
@SerializedName("preset-blocks") @SerializedName("preset-blocks")
private PresetBlocks presetBlocks = new PresetBlocks(); private PresetBlocks presetBlocks = new PresetBlocks();
@SerializedName("sitting-eye-y-bounds") @SerializedName("height-difference-limit")
private YBounds yBounds = new YBounds(); private YDifferenceLimit yDifferenceLimit = new YDifferenceLimit();
@SerializedName("custom-enabled") @SerializedName("custom-enabled")
private Boolean customEnabled = false; private Boolean customEnabled = false;
@ -89,8 +89,8 @@ public class ServerConfig implements CustomFile<ServerConfig> {
return presetBlocks; return presetBlocks;
} }
public YBounds getYBounds() { public YDifferenceLimit getYDifferenceLimit() {
return yBounds; return yDifferenceLimit;
} }
public Boolean isCustomEnabled() { public Boolean isCustomEnabled() {
@ -153,23 +153,23 @@ public class ServerConfig implements CustomFile<ServerConfig> {
} }
} }
public static class YBounds { public static class YDifferenceLimit {
@SerializedName("above") @SerializedName("above")
private Double above = 0.1; private Double above = 0.1;
@SerializedName("below") @SerializedName("below")
private Double below = 3.0; private Double below = 3.0;
public YBounds() { public YDifferenceLimit() {
} }
public YBounds(Double above, Double below) { public YDifferenceLimit(Double above, Double below) {
this.above = above; this.above = above;
this.below = below; this.below = below;
} }
public YBounds(YBounds yBounds) { public YDifferenceLimit(YDifferenceLimit yDifferenceLimit) {
this.above = yBounds.above; this.above = yDifferenceLimit.above;
this.below = yBounds.below; this.below = yDifferenceLimit.below;
} }
public Double getAbove() { public Double getAbove() {
@ -208,7 +208,7 @@ public class ServerConfig implements CustomFile<ServerConfig> {
this.presetBlocks = new PresetBlocks(newFile.presetBlocks); this.presetBlocks = new PresetBlocks(newFile.presetBlocks);
this.yBounds = new YBounds(newFile.yBounds); this.yDifferenceLimit = new YDifferenceLimit(newFile.yDifferenceLimit);
this.customEnabled = newFile.customEnabled; this.customEnabled = newFile.customEnabled;
this.sittingBlocks = newFile.sittingBlocks.stream().map(SittingBlock::new).collect(Collectors.toCollection(ArrayList::new)); this.sittingBlocks = newFile.sittingBlocks.stream().map(SittingBlock::new).collect(Collectors.toCollection(ArrayList::new));

View file

@ -89,12 +89,12 @@ public class Logic {
// get the height difference (positive) // get the height difference (positive)
double heightDifference = Math.abs(playerEyeY - blockY); double heightDifference = Math.abs(playerEyeY - blockY);
// get the config limits // get the config limits
ServerConfig.YBounds yBounds = FileData.getServerConfig().getYBounds(); ServerConfig.YDifferenceLimit yDifferenceLimit = FileData.getServerConfig().getYDifferenceLimit();
// debug // debug
Data.LOGGER.info("{} {} can sit? {}", heightDifference, isAbove ? "Above" : "Below", (isAbove? yBounds.getAbove(): yBounds.getBelow()) >= heightDifference); Data.LOGGER.info("{} {} can sit? {}", heightDifference, isAbove ? "Above" : "Below", (isAbove? yDifferenceLimit.getAbove(): yDifferenceLimit.getBelow()) >= heightDifference);
return (isAbove? yBounds.getAbove(): yBounds.getBelow()) >= heightDifference; return (isAbove? yDifferenceLimit.getAbove(): yDifferenceLimit.getBelow()) >= heightDifference;
} }
/** /**