use of org.bukkit.event.entity.EntityEnterBlockEvent in project Arclight by IzzelAliz.
the class BeehiveTileEntityMixin method arclight$beeEnterBlock.
@Inject(method = "tryEnterHive(Lnet/minecraft/entity/Entity;ZI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;stopRiding()V"))
private void arclight$beeEnterBlock(Entity entity, boolean p_226962_2_, int p_226962_3_, CallbackInfo ci) {
if (this.world != null) {
EntityEnterBlockEvent event = new EntityEnterBlockEvent(((EntityBridge) entity).bridge$getBukkitEntity(), CraftBlock.at(this.world, this.getPos()));
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
if (entity instanceof BeeEntity) {
((BeeEntity) entity).setStayOutOfHiveCountdown(400);
}
ci.cancel();
}
}
}
Aggregations