Paper/patches/server-remapped/0604-More-lightning-API.patch
2021-06-11 14:02:28 +02:00

69 lines
2.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: KennyTV <jahnke.nassim@gmail.com>
Date: Sun, 26 Jul 2020 14:44:09 +0200
Subject: [PATCH] More lightning API
diff --git a/src/main/java/net/minecraft/world/entity/LightningBolt.java b/src/main/java/net/minecraft/world/entity/LightningBolt.java
index 4b0dbeded2b8a475d32f518957909d3495a4b6fc..3fdef4511e21e453b89e42a8f41e587fe300ba6b 100644
--- a/src/main/java/net/minecraft/world/entity/LightningBolt.java
+++ b/src/main/java/net/minecraft/world/entity/LightningBolt.java
@@ -28,7 +28,7 @@ public class LightningBolt extends Entity {
private int life;
public long seed;
- private int flashes;
+ private int flashes; public int getFlashCount() { return flashes; } public void setFlashCount(int flashes) { this.flashes = flashes; } // Paper - OBFHELPER
public boolean visualOnly;
@Nullable
private ServerPlayer cause;
@@ -46,6 +46,16 @@ public class LightningBolt extends Entity {
this.visualOnly = cosmetic;
}
+ // Paper start
+ public int getLifeTicks() {
+ return life;
+ }
+
+ public void setLifeTicks(int lifeTicks) {
+ this.life = lifeTicks;
+ }
+ // Paper end
+
@Override
public SoundSource getSoundSource() {
return SoundSource.WEATHER;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
index 26506c22592b58b208487fb244985361d70988a8..c1593bb345b38deb4d8b28a73d8dc6246c17b873 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
@@ -45,4 +45,27 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike
return spigot;
}
// Spigot end
+
+ // Paper start
+ @Override
+ public int getFlashCount() {
+ return getHandle().getFlashCount();
+ }
+
+ @Override
+ public void setFlashCount(int flashes) {
+ com.google.common.base.Preconditions.checkArgument(flashes >= 0, "Flashes has to be a positive number!");
+ getHandle().setFlashCount(flashes);
+ }
+
+ @Override
+ public int getLifeTicks() {
+ return getHandle().getLifeTicks();
+ }
+
+ @Override
+ public void setLifeTicks(int lifeTicks) {
+ getHandle().setLifeTicks(lifeTicks);
+ }
+ // Paper end
}