Archiviert
13
0

Throw an EntityBlockFormEvent for snowmen. Thanks to feildmaster.

Dieser Commit ist enthalten in:
Nathan Adams 2012-01-15 09:11:21 +00:00
Ursprung 93b3c96126
Commit 6495eee0c9

Datei anzeigen

@ -1,7 +1,11 @@
package net.minecraft.server;
import java.util.List;
// Craftbukkit start
import org.bukkit.block.BlockState;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.block.EntityBlockFormEvent;
// Craftbukkit end
public class EntitySnowman extends EntityGolem {
@ -39,7 +43,17 @@ public class EntitySnowman extends EntityGolem {
int l = MathHelper.floor(this.locZ + (double) ((float) (i / 2 % 2 * 2 - 1) * 0.25F));
if (this.world.getTypeId(j, k, l) == 0 && this.world.getWorldChunkManager().a(j, k, l) < 0.8F && Block.SNOW.canPlace(this.world, j, k, l)) {
this.world.setTypeId(j, k, l, Block.SNOW.id);
// CraftBukkit start
BlockState blockState = this.world.getWorld().getBlockAt(j, k, l).getState();
blockState.setTypeId(Block.SNOW.id);
EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
this.world.getServer().getPluginManager().callEvent(event);
if(!event.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
}
}
@ -89,4 +103,4 @@ public class EntitySnowman extends EntityGolem {
CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end
}
}
}