aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches-Unmapped/0606-More-lightning-API.patch
blob: e08b3251e5161f5af9cb2967760ce8677a4b5ead (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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/EntityLightning.java b/src/main/java/net/minecraft/world/entity/EntityLightning.java
index 834ced9d9b385c8f1d66355244313d62a97d9c98..85f571a791bce63989890f277857bc7bdeec0cb5 100644
--- a/src/main/java/net/minecraft/world/entity/EntityLightning.java
+++ b/src/main/java/net/minecraft/world/entity/EntityLightning.java
@@ -31,7 +31,7 @@ public class EntityLightning extends Entity {
 
     private int lifeTicks;
     public long b;
-    private int d;
+    private int d; public int getFlashCount() { return d; } public void setFlashCount(int flashes) { this.d = flashes; } // Paper - OBFHELPER
     public boolean isEffect;
     @Nullable
     private EntityPlayer f;
@@ -49,6 +49,16 @@ public class EntityLightning extends Entity {
         this.isEffect = flag;
     }
 
+    // Paper start
+    public int getLifeTicks() {
+        return lifeTicks;
+    }
+
+    public void setLifeTicks(int lifeTicks) {
+        this.lifeTicks = lifeTicks;
+    }
+    // Paper end
+
     @Override
     public SoundCategory getSoundCategory() {
         return SoundCategory.WEATHER;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
index 3e054592cef6526b769d14460a671ea78a5ef58a..395f702b14425d85ff3a7938c32f7bfd5523f3ca 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
 }