mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-03 17:52:28 +01:00
#1267: Add more lightning API
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
parent
4556ae0f4b
commit
851acb6496
2 changed files with 38 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/EntityLightning.java
|
||||
+++ b/net/minecraft/world/entity/EntityLightning.java
|
||||
@@ -29,6 +29,10 @@
|
||||
@@ -29,14 +29,18 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -11,6 +11,16 @@
|
|||
public class EntityLightning extends Entity {
|
||||
|
||||
private static final int START_LIFE = 2;
|
||||
private static final double DAMAGE_RADIUS = 3.0D;
|
||||
private static final double DETECTION_RADIUS = 15.0D;
|
||||
- private int life;
|
||||
+ public int life; // PAIL private -> public
|
||||
public long seed;
|
||||
- private int flashes;
|
||||
+ public int flashes; // PAIL private -> public
|
||||
public boolean visualOnly;
|
||||
@Nullable
|
||||
private EntityPlayer cause;
|
||||
@@ -129,7 +133,7 @@
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.level.EntityPlayer;
|
||||
import net.minecraft.world.entity.EntityLightning;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.LightningStrike;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CraftLightningStrike extends CraftEntity implements LightningStrike {
|
||||
public CraftLightningStrike(final CraftServer server, final EntityLightning entity) {
|
||||
|
@ -14,6 +16,31 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike
|
|||
return getHandle().visualOnly;
|
||||
}
|
||||
|
||||
public int getFlashes() {
|
||||
return getHandle().flashes;
|
||||
}
|
||||
|
||||
public void setFlashes(int flashes) {
|
||||
getHandle().flashes = flashes;
|
||||
}
|
||||
|
||||
public int getLifeTicks() {
|
||||
return getHandle().life;
|
||||
}
|
||||
|
||||
public void setLifeTicks(int ticks) {
|
||||
getHandle().life = ticks;
|
||||
}
|
||||
|
||||
public Player getCausingPlayer() {
|
||||
EntityPlayer player = getHandle().getCause();
|
||||
return (player != null) ? player.getBukkitEntity() : null;
|
||||
}
|
||||
|
||||
public void setCausingPlayer(Player player) {
|
||||
getHandle().setCause((player != null) ? ((CraftPlayer) player).getHandle() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityLightning getHandle() {
|
||||
return (EntityLightning) entity;
|
||||
|
|
Loading…
Reference in a new issue