@SuppressWarnings({"unchecked"})
    @Override
    public void syncDataToForge(org.spongepowered.api.event.Event spongeEvent) {
      super.syncDataToForge(spongeEvent);

      ExplosionEvent.Detonate event = (ExplosionEvent.Detonate) spongeEvent;
      List<BlockPos> affectedBlocks = this.explosion.func_180343_e();
      affectedBlocks.clear();

      for (BlockTransaction blockTransaction : event.getTransactions()) {
        if (blockTransaction.isValid()) {
          affectedBlocks.add(
              VecHelper.toBlockPos(blockTransaction.getFinalReplacement().getPosition()));
        }
      }
    }
  @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;
  }
Exemplo n.º 3
0
 public BlockList blockList() {
   return new BlockList(event.getTransactions());
 }
Exemplo n.º 4
0
 public EntityType getEntityType() {
   return EntityType.getForCause(event.getCause());
 }