mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-13 11:18:23 +01:00
Added the implementation of the concept of an Explosive.
This commit is contained in:
parent
10fb5dc843
commit
fadd962b9c
4 changed files with 51 additions and 6 deletions
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.entity.Explosive;
|
||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
@ -26,6 +27,9 @@ public class EntityFireball extends Entity {
|
|||
public double d;
|
||||
public double e;
|
||||
|
||||
public float yield = 1; // CraftBukkit
|
||||
public boolean isIncendiary = true; // CraftBukkit
|
||||
|
||||
public EntityFireball(World world) {
|
||||
super(world);
|
||||
this.b(1.0F, 1.0F);
|
||||
|
@ -151,7 +155,7 @@ public class EntityFireball extends Entity {
|
|||
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent(CraftEntity.getEntity(server, this), 1.0F, true);
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent((Explosive) CraftEntity.getEntity(server, this));
|
||||
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
|
|
|
@ -3,12 +3,15 @@ package net.minecraft.server;
|
|||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.entity.Explosive;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityTNTPrimed extends Entity {
|
||||
|
||||
public int a;
|
||||
public float yield = 4; // CraftBukkit
|
||||
public boolean isIncendiary = false; // CraftBukkit
|
||||
|
||||
public EntityTNTPrimed(World world) {
|
||||
super(world);
|
||||
|
@ -72,12 +75,12 @@ public class EntityTNTPrimed extends Entity {
|
|||
}
|
||||
|
||||
private void explode() {
|
||||
float f = 4.0F;
|
||||
|
||||
// CraftBukkit start
|
||||
// float f = 4.0F;
|
||||
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent(CraftEntity.getEntity(server, this), f, false);
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent((Explosive) CraftEntity.getEntity(server, this));
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
|
|
|
@ -7,8 +7,6 @@ import org.bukkit.entity.Fireball;
|
|||
|
||||
/**
|
||||
* A Fireball.
|
||||
*
|
||||
* @author Cogito
|
||||
*/
|
||||
public class CraftFireball extends CraftEntity implements Fireball {
|
||||
public CraftFireball(CraftServer server, EntityFireball entity) {
|
||||
|
@ -19,4 +17,20 @@ public class CraftFireball extends CraftEntity implements Fireball {
|
|||
public String toString() {
|
||||
return "CraftFireball";
|
||||
}
|
||||
|
||||
public float getYield() {
|
||||
return ((EntityFireball) getHandle()).yield;
|
||||
}
|
||||
|
||||
public boolean isIncendiary() {
|
||||
return ((EntityFireball) getHandle()).isIncendiary;
|
||||
}
|
||||
|
||||
public void setIsIncendiary(boolean isIncendiary) {
|
||||
((EntityFireball) getHandle()).isIncendiary = isIncendiary;
|
||||
}
|
||||
|
||||
public void setYield(float yield) {
|
||||
((EntityFireball) getHandle()).yield = yield;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,4 +16,28 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
|
|||
return "CraftTNTPrimed";
|
||||
}
|
||||
|
||||
public float getYield() {
|
||||
return ((EntityTNTPrimed) getHandle()).yield;
|
||||
}
|
||||
|
||||
public boolean isIncendiary() {
|
||||
return ((EntityTNTPrimed) getHandle()).isIncendiary;
|
||||
}
|
||||
|
||||
public void setIsIncendiary(boolean isIncendiary) {
|
||||
((EntityTNTPrimed) getHandle()).isIncendiary = isIncendiary;
|
||||
}
|
||||
|
||||
public void setYield(float yield) {
|
||||
((EntityTNTPrimed) getHandle()).yield = yield;
|
||||
}
|
||||
|
||||
public int getFuseTicks() {
|
||||
return ((EntityTNTPrimed) getHandle()).a;
|
||||
}
|
||||
|
||||
public void setFuseTicks(int fuseTicks) {
|
||||
((EntityTNTPrimed) getHandle()).a = fuseTicks;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue