Missing barrier block for stationary dragon causes water to overflow
ZizzyZizzy opened this issue ยท 3 comments
There's one block missing in the pattern of barrier blocks created to contain the water for the "WingFixerTask" in /src/main/java/eu/phiwa/dragontravel/nms/[version]/RyeDragon.java.
They all look like this:
int counter = 0;
for (int y = 0; y <= 2; y++) {
for (int x = -1; x <= 1; x++) {
m[counter] = loc.clone().add(x, -y, 0).getBlock().getType();
md[counter] = loc.clone().add(x, -y, 0).getBlock().getState().getData();
loc.clone().add(x, -y, 0).getBlock().setType(Material.BARRIER);
counter++;
}
for (int z = -1; z <= 1; z++) {
if (z == 0) continue;
m[counter] = loc.clone().add(0, -y, z).getBlock().getType();
md[counter] = loc.clone().add(0, -y, z).getBlock().getState().getData();
loc.clone().add(0, -y, z).getBlock().setType(Material.BARRIER);
counter++;
}
if (y == 0) {
loc.getBlock().setType(Material.WATER);
}
if (y == 1) {
loc.clone().add(0, -1, 0).getBlock().setType(Material.AIR);
}
}
The if condition for z is missing a check for y, so a there is a hole in the pattern of barrier blocks that allows water to escape.
To fix, change the if condition to:
if (z == 0 && y == 0) continue;
Also, what exactly was that supposed to fix, anyway? I disabled the call to dragon.fixWings and the dragon seems to act the same way without the extra barrier blocks and water.
I only tested on 1.15.2 however. Maybe an issue in older versions of Minecraft?
In older versions, the dragon's wings were flapping really fast which was kind of annoying and ruining the atmosphere.
Contact with water and receiving damage slowed them down and after a few seconds, they would keep the slower rate, even without water/damage.
I just tried it again and it really seems like the problem has been fixed in Minecraft/Spigot itself, so I guess, we could go without it for newer versions.
Since I don't want to spend hours trying to find the exact version is has been fixed in (reproduced the problem in 1.7.9), I simply tested it with 1.13-1.15 and the problem seems to be solved.
I disabled the fix and if there is no problem with it in the next versions, I'll clean it up completely.
@ZizzyZizzy Thanks for your contribution!