@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntitySlime.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySlime.java
|
||||
@@ -45,6 +45,15 @@
|
||||
import net.minecraft.world.level.levelgen.SeededRandom;
|
||||
@@ -47,6 +47,15 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.ArrayList;
|
||||
@@ -16,7 +16,7 @@
|
||||
public class EntitySlime extends EntityInsentient implements IMonster {
|
||||
|
||||
private static final DataWatcherObject<Integer> ID_SIZE = DataWatcher.defineId(EntitySlime.class, DataWatcherRegistry.INT);
|
||||
@@ -195,11 +204,18 @@
|
||||
@@ -197,11 +206,18 @@
|
||||
|
||||
@Override
|
||||
public EntityTypes<? extends EntitySlime> getType() {
|
||||
@@ -36,9 +36,9 @@
|
||||
int i = this.getSize();
|
||||
|
||||
if (!this.level().isClientSide && i > 1 && this.isDeadOrDying()) {
|
||||
@@ -210,6 +226,19 @@
|
||||
int j = i / 2;
|
||||
@@ -211,18 +227,45 @@
|
||||
int k = 2 + this.random.nextInt(3);
|
||||
ScoreboardTeam scoreboardteam = this.getTeam();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), k);
|
||||
@@ -56,19 +56,24 @@
|
||||
for (int l = 0; l < k; ++l) {
|
||||
float f2 = ((float) (l % 2) - 0.5F) * f1;
|
||||
float f3 = ((float) (l / 2) - 0.5F) * f1;
|
||||
@@ -225,12 +254,21 @@
|
||||
entityslime.setInvulnerable(this.isInvulnerable());
|
||||
|
||||
- this.convertTo(this.getType(), new ConversionParams(ConversionType.SPLIT_ON_DEATH, false, false, scoreboardteam), EntitySpawnReason.TRIGGERED, (entityslime) -> {
|
||||
+ EntitySlime converted = this.convertTo(this.getType(), new ConversionParams(ConversionType.SPLIT_ON_DEATH, false, false, scoreboardteam), EntitySpawnReason.TRIGGERED, (entityslime) -> { // CraftBukkit
|
||||
entityslime.setSize(j, true);
|
||||
entityslime.moveTo(this.getX() + (double) f2, this.getY() + 0.5D, this.getZ() + (double) f3, this.random.nextFloat() * 360.0F, 0.0F);
|
||||
- this.level().addFreshEntity(entityslime);
|
||||
+ slimes.add(entityslime); // CraftBukkit
|
||||
}
|
||||
}
|
||||
- });
|
||||
+ // CraftBukkit start
|
||||
+ }, null, null);
|
||||
+ if (converted != null) {
|
||||
+ slimes.add(converted);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, slimes, EntityTransformEvent.TransformReason.SPLIT).isCancelled()) {
|
||||
+ super.remove(entity_removalreason, cause); // CraftBukkit - add Bukkit remove cause
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
+ for (EntityLiving living : slimes) {
|
||||
+ this.level().addFreshEntity(living, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
|
||||
+ }
|
||||
|
||||
Reference in New Issue
Block a user