本文整理汇总了Java中org.bukkit.event.entity.SlimeSplitEvent类的典型用法代码示例。如果您正苦于以下问题:Java SlimeSplitEvent类的具体用法?Java SlimeSplitEvent怎么用?Java SlimeSplitEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SlimeSplitEvent类属于org.bukkit.event.entity包,在下文中一共展示了SlimeSplitEvent类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSlimeSplit
import org.bukkit.event.entity.SlimeSplitEvent; //导入依赖的package包/类
@EventHandler
public void onSlimeSplit(SlimeSplitEvent event)
{
Slime slime = event.getEntity();
if (plugin.getLegendaryEntityId() != null && plugin.getLegendaryEntityId().equals(slime.getUniqueId()))
{
event.setCount(0);
Player killer = slime.getKiller();
if (killer != null)
{
Material mat = MaterialUtil.getMaterial(plugin.getConfig().getString("slimeDropsType"));
slime.getWorld().dropItem(slime.getLocation(), new ItemStack(mat, plugin.getConfig().getInt("slimeDropsAmount")));
killer.sendMessage(ChatColor.GREEN + "You have killed a legendary monster!");
}
slime.remove();
plugin.removeLegendary();
}
}
示例2: die
import org.bukkit.event.entity.SlimeSplitEvent; //导入依赖的package包/类
public void die() {
int i = this.getSize();
if (!this.world.isStatic && i > 1 && this.getHealth() <= 0.0F) {
int j = 2 + this.random.nextInt(3);
// CraftBukkit start
SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), j);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled() && event.getCount() > 0) {
j = event.getCount();
} else {
super.die();
return;
}
// CraftBukkit end
for (int k = 0; k < j; ++k) {
float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
EntitySlime entityslime = this.bQ();
entityslime.setSize(i / 2);
entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
this.world.addEntity(entityslime, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
}
}
super.die();
}
示例3: die
import org.bukkit.event.entity.SlimeSplitEvent; //导入依赖的package包/类
public void die() {
int i = this.getSize();
if (!this.world.isStatic && i > 1 && this.getHealth() <= 0.0F) {
int j = 2 + this.random.nextInt(3);
// CraftBukkit start
SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), j);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled() && event.getCount() > 0) {
j = event.getCount();
} else {
super.die();
return;
}
// CraftBukkit end
for (int k = 0; k < j; ++k) {
float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
EntitySlime entityslime = this.bK();
entityslime.setSize(i / 2);
entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
this.world.addEntity(entityslime, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
}
}
super.die();
}
示例4: setDead
import org.bukkit.event.entity.SlimeSplitEvent; //导入依赖的package包/类
public void setDead()
{
int i = this.getSlimeSize();
if (!this.worldObj.isRemote && i > 1 && this.getHealth() <= 0.0F)
{
int j = 2 + this.rand.nextInt(3);
// CraftBukkit start
SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), j);
this.worldObj.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled() && event.getCount() > 0)
{
j = event.getCount();
}
else
{
super.setDead();
return;
}
// CraftBukkit end
for (int k = 0; k < j; ++k)
{
float f = ((float)(k % 2) - 0.5F) * (float)i / 4.0F;
float f1 = ((float)(k / 2) - 0.5F) * (float)i / 4.0F;
EntitySlime entityslime = this.createInstance();
entityslime.setSlimeSize(i / 2);
entityslime.setLocationAndAngles(this.posX + (double)f, this.posY + 0.5D, this.posZ + (double)f1, this.rand.nextFloat() * 360.0F, 0.0F);
this.worldObj.addEntity(entityslime, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
}
}
super.setDead();
}
示例5: die
import org.bukkit.event.entity.SlimeSplitEvent; //导入依赖的package包/类
public void die() {
int i = this.getSize();
if (!this.world.isClientSide && i > 1 && this.getHealth() <= 0.0F) {
int j = 2 + this.random.nextInt(3);
// CraftBukkit start
SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), j);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled() && event.getCount() > 0) {
j = event.getCount();
} else {
super.die();
return;
}
// CraftBukkit end
for (int k = 0; k < j; ++k) {
float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
EntitySlime entityslime = this.cU();
if (this.hasCustomName()) {
entityslime.setCustomName(this.getCustomName());
}
if (this.isPersistent()) {
entityslime.cM();
}
entityslime.setSize(i / 2);
entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
this.world.addEntity(entityslime, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
}
}
super.die();
}
示例6: die
import org.bukkit.event.entity.SlimeSplitEvent; //导入依赖的package包/类
public void die() {
int i = this.getSize();
if (!this.world.isStatic && i > 1 && this.getHealth() <= 0) {
int j = 2 + this.random.nextInt(3);
// CraftBukkit start
SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), j);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled() && event.getCount() > 0) {
j = event.getCount();
} else {
super.die();
return;
}
// CraftBukkit end
for (int k = 0; k < j; ++k) {
float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
EntitySlime entityslime = this.i();
entityslime.setSize(i / 2);
entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
this.world.addEntity(entityslime, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
}
}
super.die();
}
示例7: onSlimeSplit
import org.bukkit.event.entity.SlimeSplitEvent; //导入依赖的package包/类
@EventHandler
public void onSlimeSplit(SlimeSplitEvent event) {
event.setCancelled(true);
}
示例8: onSlimeSplit
import org.bukkit.event.entity.SlimeSplitEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSlimeSplit(SlimeSplitEvent event) {
if(event.getCount() > 0 && resolveEntity(event.getEntity()) != null) {
splitter = new WeakReference<>(event.getEntity());
}
}