Skip to content

Commit f9d7a7d

Browse files
committed
Increase version and improve EarthLine
- Increase version to 2.9.0. - Fix EarthLine render issue that has existed for a long time where the falling blocks aren't spawned at the center of the block. - Improve EarthLine climbing/falling.
1 parent 667435b commit f9d7a7d

File tree

2 files changed

+31
-16
lines changed

2 files changed

+31
-16
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.jedk1</groupId>
66
<artifactId>jedcore</artifactId>
7-
<version>2.8.2-Spigot1.14.4-PK1.8.8</version>
7+
<version>2.9.0-Spigot1.14.4-PK1.8.9</version>
88
<packaging>jar</packaging>
99
<name>JedCore</name>
1010

@@ -34,7 +34,7 @@
3434
<dependency>
3535
<groupId>com.projectkorra</groupId>
3636
<artifactId>projectkorra</artifactId>
37-
<version>1.8.8</version>
37+
<version>1.8.9</version>
3838
<scope>provided</scope>
3939
</dependency>
4040
</dependencies>

src/com/jedk1/jedcore/ability/earthbending/EarthLine.java

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.bukkit.Location;
2020
import org.bukkit.Material;
2121
import org.bukkit.block.Block;
22+
import org.bukkit.block.BlockFace;
2223
import org.bukkit.configuration.ConfigurationSection;
2324
import org.bukkit.entity.Entity;
2425
import org.bukkit.entity.LivingEntity;
@@ -225,28 +226,21 @@ public void progress() {
225226
Vector push = new Vector(x1 - x0, 0.34999999999999998D, z1 - z0);
226227
if (location.distance(sourceblock.getLocation()) < range) {
227228
Material cloneType = location.getBlock().getType();
228-
Location locationYUP = location.clone().add(0.0D, 0.1D, 0.0D);
229+
Location locationYUP = location.getBlock().getLocation().clone().add(0.5, 0.1, 0.5);
229230

230231
playEarthbendingSound(location);
231232

232233
new RegenTempBlock(location.getBlock(), Material.AIR, Material.AIR.createBlockData(), 700L);
233234

234-
new TempFallingBlock(locationYUP, cloneType.createBlockData(), push, this);
235+
new TempFallingBlock(locationYUP, cloneType.createBlockData(), new Vector(0.0, 0.35, 0.0), this);
235236

236237
location.add(looking.normalize());
237-
if (!ElementalAbility.isAir(location.clone().add(0.0D, 1.0D, 0.0D).getBlock().getType()) && !isTransparent(location.clone().add(0.0D, 1.0D, 0.0D).getBlock())) {
238-
location.add(0.0D, 1.0D, 0.0D);
239-
if (!isEarthbendable(player, location.getBlock()) || !ElementalAbility.isAir(location.clone().add(0.0D, 1.0D, 0.0D).getBlock().getType()) && !isTransparent(location.clone().add(0.0D, 1.0D, 0.0D).getBlock())) {
240-
remove();
241-
return;
242-
}
243-
} else if ((ElementalAbility.isAir(location.clone().getBlock().getType()) || isTransparent(location.clone().add(0.0D, 1.0D, 0.0D).getBlock())) && !ElementalAbility.isAir(location.clone().add(0.0D, -1D, 0.0D).getBlock().getType())) {
244-
location.add(0.0D, -1D, 0.0D);
245-
if (!isEarthbendable(player, location.clone().getBlock()) || ElementalAbility.isAir(location.clone().add(0.0D, -1D, 0.0D).getBlock().getType())) {
246-
remove();
247-
return;
248-
}
238+
239+
if (!climb()) {
240+
remove();
241+
return;
249242
}
243+
250244
if (hitted) {
251245
if (goOnAfterHit != 0) {
252246
goOnAfterHit--;
@@ -276,6 +270,27 @@ public void progress() {
276270
}
277271
return;
278272
}
273+
274+
private boolean climb() {
275+
Block above = location.getBlock().getRelative(BlockFace.UP);
276+
277+
if (!isTransparent(above)) {
278+
// Attempt to climb since the current location has a block above it.
279+
location.add(0, 1, 0);
280+
above = location.getBlock().getRelative(BlockFace.UP);
281+
282+
// The new location must be earthbendable and have something transparent above it.
283+
return isEarthbendable(location.getBlock()) && isTransparent(above);
284+
} else if (isTransparent(location.getBlock()) ) {
285+
// Attempt to fall since the current location is transparent and the above block was transparent.
286+
location.add(0, -1, 0);
287+
288+
// The new location must be earthbendable and we already know the block above it is transparent.
289+
return isEarthbendable(location.getBlock());
290+
}
291+
292+
return true;
293+
}
279294

280295
@Override
281296
public long getCooldown() {

0 commit comments

Comments
 (0)