#762: Add TNTPrimed#setSource method

By: Jakub Zacek <dawon.cz@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2020-10-25 18:10:08 +11:00
parent 834e89eca0
commit d66dca2a11
2 changed files with 14 additions and 3 deletions

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityTNTPrimed.java
+++ b/net/minecraft/server/EntityTNTPrimed.java
@@ -1,6 +1,7 @@
@@ -1,13 +1,16 @@
package net.minecraft.server;
import javax.annotation.Nullable;
@ -8,9 +8,10 @@
public class EntityTNTPrimed extends Entity {
@@ -8,6 +9,8 @@
private static final DataWatcherObject<Integer> FUSE_TICKS = DataWatcher.a(EntityTNTPrimed.class, DataWatcherRegistry.b);
@Nullable
private EntityLiving source;
- private EntityLiving source;
+ public EntityLiving source; // PAIL private -> public
private int fuseTicks;
+ public float yield = 4; // CraftBukkit - add field
+ public boolean isIncendiary = false; // CraftBukkit - add field

View file

@ -5,6 +5,7 @@ import net.minecraft.server.EntityTNTPrimed;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.TNTPrimed;
public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
@ -64,4 +65,13 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
return (source != null) ? source.getBukkitEntity() : null;
}
@Override
public void setSource(Entity source) {
if (source instanceof LivingEntity) {
getHandle().source = ((CraftLivingEntity) source).getHandle();
} else {
getHandle().source = null;
}
}
}