@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") @Override public void syncDataToSponge(net.minecraftforge.fml.common.eventhandler.Event forgeEvent) { super.syncDataToSponge(forgeEvent); net.minecraftforge.event.world.ExplosionEvent event = (net.minecraftforge.event.world.ExplosionEvent) forgeEvent; // TODO - handle this better List<BlockPos> affectedBlocks = event.explosion.func_180343_e(); for (BlockTransaction transaction : this.blockTransactions) { BlockPos pos = VecHelper.toBlockPos(transaction.getFinalReplacement().getPosition()); boolean match = false; for (BlockPos forgePos : affectedBlocks) { if (forgePos.getX() == pos.getX() && forgePos.getY() == pos.getY() && forgePos.getZ() == pos.getZ()) { match = true; } } if (!match) { transaction.setIsValid(false); } } }