@SuppressWarnings("unchecked")
  public static net.minecraftforge.event.world.ExplosionEvent.Detonate createExplosionDetonateEvent(
      Event event) {
    if (!(event instanceof ExplosionEvent.Detonate)) {
      throw new IllegalArgumentException("Event is not a valid ExplosionEvent.Detonate.");
    }

    ExplosionEvent.Detonate spongeEvent = (ExplosionEvent.Detonate) event;
    Optional<World> world = spongeEvent.getCause().first(World.class);
    if (!world.isPresent()) {
      return null;
    }

    net.minecraft.world.World forgeWorld = (net.minecraft.world.World) world.get();
    Explosion explosion = (Explosion) spongeEvent.getExplosion();
    net.minecraftforge.event.world.ExplosionEvent.Detonate forgeEvent =
        new net.minecraftforge.event.world.ExplosionEvent.Detonate(
            forgeWorld, explosion, (List<Entity>) (Object) spongeEvent.getEntities());
    return forgeEvent;
  }
예제 #2
0
 public EntityType getEntityType() {
   return EntityType.getForCause(event.getCause());
 }