rewrite particle display a bit
This commit is contained in:
parent
9fd247951a
commit
09fd55b64d
common/src/main/java/io/github/flemmli97/flan
@ -1,6 +1,5 @@
|
|||||||
package io.github.flemmli97.flan.api.permission;
|
package io.github.flemmli97.flan.api.permission;
|
||||||
|
|
||||||
import com.google.gson.JsonSyntaxException;
|
|
||||||
import io.github.flemmli97.flan.CrossPlatformStuff;
|
import io.github.flemmli97.flan.CrossPlatformStuff;
|
||||||
import io.github.flemmli97.flan.config.ConfigHandler;
|
import io.github.flemmli97.flan.config.ConfigHandler;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
|
@ -36,7 +36,7 @@ public class ClaimDisplay {
|
|||||||
this.displayTime = ConfigHandler.config.claimDisplayTime;
|
this.displayTime = ConfigHandler.config.claimDisplayTime;
|
||||||
this.prevDims = claim.getDimensions();
|
this.prevDims = claim.getDimensions();
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.height = y;
|
this.height = Math.max(1 + claim.getWorld().getMinBuildHeight(), y);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SUB:
|
case SUB:
|
||||||
this.corner = ParticleIndicators.SUBCLAIMCORNER;
|
this.corner = ParticleIndicators.SUBCLAIMCORNER;
|
||||||
@ -141,37 +141,46 @@ public class ClaimDisplay {
|
|||||||
// SAFETY: Ensure that the X/Z coordinates are for the given chunk
|
// SAFETY: Ensure that the X/Z coordinates are for the given chunk
|
||||||
// since the position is mutating only up or down, it's always in the same chunk
|
// since the position is mutating only up or down, it's always in the same chunk
|
||||||
private static int[] nextAirAndWaterBlockFrom(LevelChunk chunk, int x, int y, int z) {
|
private static int[] nextAirAndWaterBlockFrom(LevelChunk chunk, int x, int y, int z) {
|
||||||
BlockPos pos = new BlockPos(x, y, z);
|
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(x, y, z);
|
||||||
BlockState state = chunk.getBlockState(pos);
|
BlockState state = chunk.getBlockState(pos);
|
||||||
if (state.getMaterial().isReplaceable()) {
|
if (state.getMaterial().isReplaceable()) {
|
||||||
pos = pos.below();
|
//Move Down
|
||||||
state = chunk.getBlockState(pos);
|
boolean startedInLiquid = state.getMaterial().isLiquid();
|
||||||
|
boolean liquidCheck = false;
|
||||||
|
int liquidHeight = pos.getY();
|
||||||
while (state.getMaterial().isReplaceable() && !chunk.isOutsideBuildHeight(pos)) {
|
while (state.getMaterial().isReplaceable() && !chunk.isOutsideBuildHeight(pos)) {
|
||||||
pos = pos.below();
|
pos.move(0, -1, 0);
|
||||||
state = chunk.getBlockState(pos);
|
state = chunk.getBlockState(pos);
|
||||||
|
if (!startedInLiquid && !liquidCheck && state.getMaterial().isLiquid()) {
|
||||||
|
liquidCheck = true;
|
||||||
|
liquidHeight = pos.getY();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pos = pos.above();
|
int[] yRet = {pos.getY() + 1, (liquidCheck ? liquidHeight : pos.getY()) + 1};
|
||||||
state = chunk.getBlockState(pos);
|
if (startedInLiquid) {
|
||||||
} else {
|
pos.set(pos.getX(), liquidHeight + 1, pos.getZ());
|
||||||
pos = pos.above();
|
|
||||||
state = chunk.getBlockState(pos);
|
|
||||||
while (!state.getMaterial().isReplaceable()) {
|
|
||||||
pos = pos.above();
|
|
||||||
state = chunk.getBlockState(pos);
|
state = chunk.getBlockState(pos);
|
||||||
|
while (state.getMaterial().isLiquid() && !chunk.isOutsideBuildHeight(pos)) {
|
||||||
|
pos.move(0, 1, 0);
|
||||||
|
state = chunk.getBlockState(pos);
|
||||||
|
}
|
||||||
|
if (state.getMaterial().isReplaceable())
|
||||||
|
yRet[1] = pos.getY();
|
||||||
}
|
}
|
||||||
|
return yRet;
|
||||||
|
}
|
||||||
|
//Move Up
|
||||||
|
while (!state.getMaterial().isReplaceable() && !chunk.isOutsideBuildHeight(pos)) {
|
||||||
|
pos.move(0, 1, 0);
|
||||||
|
state = chunk.getBlockState(pos);
|
||||||
}
|
}
|
||||||
int[] yRet = {pos.getY(), pos.getY()};
|
int[] yRet = {pos.getY(), pos.getY()};
|
||||||
if (state.getMaterial().isLiquid()) {
|
while (state.getMaterial().isLiquid() && !chunk.isOutsideBuildHeight(pos)) {
|
||||||
pos = pos.above();
|
pos.move(0, 1, 0);
|
||||||
state = chunk.getBlockState(pos);
|
state = chunk.getBlockState(pos);
|
||||||
while (state.getMaterial().isLiquid()) {
|
|
||||||
pos = pos.above();
|
|
||||||
state = chunk.getBlockState(pos);
|
|
||||||
}
|
|
||||||
if (state.getMaterial().isReplaceable())
|
|
||||||
yRet[1] = pos.getY();
|
|
||||||
}
|
}
|
||||||
|
if (state.getMaterial().isReplaceable())
|
||||||
|
yRet[1] = pos.getY();
|
||||||
return yRet;
|
return yRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user